[SciPy-user] temporary copies for in-place array modification?
Steve Schmerler
elcorto at gmx.net
Mon Jul 28 07:41:59 EDT 2008
Hi all
Say I do this:
>>> a
array([1, 2, 3, 4, 5, 6])
>>> a[1:] = a[1:] - a[:-1]
>>> a
array([1, 1, 1, 1, 1, 1])
>>> b = a[1:]
>>> ...
I.e. I want to compute the difference of a's elements and store them in place
in b = a[1:] to work with that (b is only a view so that's ok, no copy).
Are there any temp copies of `a` involved? I ask b/c `a` will be large.
Thanks!
steve
More information about the SciPy-User
mailing list