> 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)
>
> ('+' on numpy array's is just a synonym for np.add; np.add is a ufunc,
> and all ufunc's accept this syntax:
>  http://docs.scipy.org/doc/numpy/reference/ufuncs.html
> )


Is the creation of the tmp as expensive as creation of a new numpy
array or is it somewhat  lighter weight (like being just a data
buffer). I sometimes use the c[:] syntax thinking I might benefit from
numpy.array re-use. But now I think that was misguided.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to