That does seem like it should work well if len(unique(idx)) is close to len(x). Thanks!
On Wed, Jun 6, 2012 at 9:35 AM, Robert Kern <[email protected]> wrote: > On Wed, Jun 6, 2012 at 4:52 PM, Robert Cimrman <[email protected]> > wrote: > > > Yes (in that thread), but it applies also adding/assembling vectors into > a > > global vector - this is just x[idx] += vals. I linked that discussion as > that > > was recent enough for me to recall it, but there were other. > > > > Anyway, my point was that a having a function with the "adding" > semantics in > > NumPy would be handy. > > x += numpy.bincount(idx, vals, minlength=len(x)) > > -- > Robert Kern > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
