Bumping my question tentatively. I am fairly sure there is a good answer and for some reason it got overlooked.<br><br>Regards<br> srean<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">srean</b> <span dir="ltr"><<a href="mailto:srean.list@gmail.com">srean.list@gmail.com</a>></span><br>
Date: Fri, May 27, 2011 at 10:36 AM<br>Subject: Adding the arrays in an array iterator<br>To: Discussion of Numerical Python <<a href="mailto:numpy-discussion@scipy.org">numpy-discussion@scipy.org</a>><br><br><br>Hi List,<br>
<br> I have to sum up an unknown number of ndarrays of the same size. These arrays, possibly thousands in number, are provided via an iterator. Right now I use python reduce with operator.add.<br><br> Does that invoke the corresponding ufunc internally ? I want to avoid creating temporaries, which I suspect a naive invocation of reduce will create. With ufunc I know how to avoid making copies using the output parameter, but not sure how to make use of that in reduce.<br>
<br> It is not essential that I use reduce though, so I would welcome idiomatic and efficient way of executing this. So far I have stayed away from building an ndarray object and summing across the relevant dimension. Is that what I should be doing ? Different invocations of this function has different number of arrays, so I cannot pre-compile away this into a numexpr.<br>
<br>Thanks and regards<br><font color="#888888"> srean<br>
</font></div><br>