Re: [Numpy-discussion] optimizing ndarray.__setitem__

2011-05-05 Thread Nathaniel Smith
On Thu, May 5, 2011 at 9:54 AM, Robert Kern wrote: > On Thu, May 5, 2011 at 02:29, Christoph Groth wrote: >> Has something like __index_iadd__ ever been considered seriously?  Not >> to my (limited) knowledge. > > Only on this list, I think. :-) > > I don't think it will ever happen. Only numpy r

Re: [Numpy-discussion] optimizing ndarray.__setitem__

2011-05-05 Thread Robert Kern
On Thu, May 5, 2011 at 02:29, Christoph Groth wrote: >> On Wed, May 4, 2011 at 6:19 AM, Christoph Groth wrote: >>> >>>     Dear numpy experts, >>> >>>     I have noticed that with Numpy 1.5.1 the operation >>> >>>     m[::2] += 1.0 >>> >>>     takes twice as long as >>> >>>     t = m[::2] >>>    

Re: [Numpy-discussion] optimizing ndarray.__setitem__

2011-05-05 Thread Gael Varoquaux
On Wed, May 04, 2011 at 08:57:42AM -0700, Mark Wiebe wrote: >You'd better time this in 1.6 too. ;) >  > [2]https://github.com/numpy/numpy/commit/f60797ba64ccf33597225d23b893b6eb11149860 Awesome work! That's all I have to say. I find very enjoyable the generalized use of the time machine i

Re: [Numpy-discussion] optimizing ndarray.__setitem__

2011-05-05 Thread Christoph Groth
> On Wed, May 4, 2011 at 6:19 AM, Christoph Groth wrote: >> >> Dear numpy experts, >> >> I have noticed that with Numpy 1.5.1 the operation >> >> m[::2] += 1.0 >> >> takes twice as long as >> >> t = m[::2] >> t += 1.0 Mark Wiebe writes: > You'd better tim

Re: [Numpy-discussion] optimizing ndarray.__setitem__

2011-05-04 Thread Mark Wiebe
On Wed, May 4, 2011 at 6:19 AM, Christoph Groth wrote: > Dear numpy experts, > > I have noticed that with Numpy 1.5.1 the operation > > m[::2] += 1.0 > > takes twice as long as > > t = m[::2] > t += 1.0 > > where "m" is some large matrix. This is of course because the first > snippet is equivale

Re: [Numpy-discussion] optimizing ndarray.__setitem__

2011-05-04 Thread Robert Kern
On Wed, May 4, 2011 at 08:19, Christoph Groth wrote: > Dear numpy experts, > > I have noticed that with Numpy 1.5.1 the operation > > m[::2] += 1.0 > > takes twice as long as > > t = m[::2] > t += 1.0 > > where "m" is some large matrix.  This is of course because the first > snippet is equivalent

[Numpy-discussion] optimizing ndarray.__setitem__

2011-05-04 Thread Christoph Groth
Dear numpy experts, I have noticed that with Numpy 1.5.1 the operation m[::2] += 1.0 takes twice as long as t = m[::2] t += 1.0 where "m" is some large matrix. This is of course because the first snippet is equivalent to t = m[::2] t += 1.0 m[::2] = t I wonder whether it would not be a good