[SciPy-user] temporary copies for in-place array modification?

Steve Schmerler elcorto@gmx....
Mon Jul 28 06:41:59 CDT 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