[Numpy-discussion] [Repost] Adding the arrays returned in an array iterator

srean srean.list at gmail.com
Fri Jun 3 21:25:57 EDT 2011


> If they are in a list, then I would do something like

Apologies if it wasnt clear in my previous mail. The arrays are in a
lazy iterator, they are non-contiguous and there are several thousands
of them. I was hoping there was a way to get at a "+=" operator for
arrays to use in a reduce. Seems like indeed there is. I had missed
operator.iadd()

> result = arrays[0].copy()
> for a in arrays[1:]:
>     result += a
>
> But much depends on the details of your problem.

> Chuck



More information about the NumPy-Discussion mailing list