[Numpy-discussion] performing operations in-place in numpy
Stéfan van der Walt
Wed Jul 8 15:38:31 CDT 2009
2009/7/8 Citi, Luca <email@example.com>:
> Hello guys,
> I made a patch for numpy which allows performing
> operations in-place to save memory allocations.
> For example 'sqrt(a**2 + b**2)' can be performed
> allocating only two arrays instead of four.
> You find the details in ticket 1153 of numpy-core.
> I thought maybe you could be interested.
> I am impatient to have some feedback from the
In the ticket you wrote: "The approach works in most cases (it passes
most of the numpy tests) but makes the assumption that ufuncs can work
even if one of the inputs is used as output. Is this an acceptable
constraint on ufuncs?".
I don't think we can make that assumption. People doing
c = a + b + d
expect a, b and d to remain unchanged.
If this functionality could somehow be put in a scikit, I'm sure it
would be useful (and to some extent, that is what `numexpr` does).
More information about the NumPy-Discussion