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

srean srean.list@gmail....
Fri Jun 3 20:25:57 CDT 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