Hi,

  is there a guarantee that ufuncs will execute left to right and in
sequential order ? For instance is the following code standards compliant ?

>>> import numpy as n
>>> a=n.arange(0,5)
array([0, 1, 2, 3, 4])
>>> n.add(a[0:-1], a[1:], a[0:-1])
array([1, 3, 5, 7])

The idea was to reuse and hence save space. The place where I write to is
not accessed again.

I am quite surprised that the following works correctly.

>>>n.add.accumulate(a,out=a)

I guess it uses a buffer and rebinds `a` to that buffer at the end. It is
also faster than

>>> n.add(a[0:-1], a[1:], a[1:])

--sean
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to