[Numpy-discussion] performing operations in-place in numpy
Charles R Harris
Wed Jul 8 17:13:45 CDT 2009
On Wed, Jul 8, 2009 at 4:10 PM, Citi, Luca <firstname.lastname@example.org> wrote:
> @Charles R Harris
> >> For example 'sqrt(a**2 + b**2)' can be performed...
> > I think this particular function is already available as a ufunc.
> I am not sure it is implemented as ufunc.
> But in any case it was just an example.
> Another example is
> that is currently implemented allocating a temporary vector for
> (2*pi*w), another temporary vector for (2*pi*w+phi) and another
> for sin(2*pi*w+phi).
> With my patch only the first temporary vector is allocated,
> then it is reused twice and finally returned.
> One allocation instead of three.
> All this happens under the hood and is completely transparent to the user.
On thing to keep in mind is that the inputs might be different views of the
same array so the elements might accessed in an unexpected order.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion