[Numpy-discussion] memory allocation at assignment

Pierre Haessig pierre.haessig@crans....
Thu Jun 28 01:20:00 CDT 2012


Le 28/06/2012 02:34, Nathaniel Smith a écrit :
> Yes it does. If you want to avoid this extra copy, and have a
> pre-existing output array, you can do:
>
> np.add(a, b, out=c)
And is there a temporary copy when using inplace operators like:

c = a.copy()
c += b

Is there a temporary (c+b)  array which is then assigned to c, or is it
really an inplace assignment as the operator +=  would suggest ?

Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120628/96517d5f/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120628/96517d5f/attachment.bin 


More information about the NumPy-Discussion mailing list