That does seem like it should work well if len(unique(idx)) is close to len(x). Thanks!<br><br><div class="gmail_quote">On Wed, Jun 6, 2012 at 9:35 AM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com" target="_blank">robert.kern@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Wed, Jun 6, 2012 at 4:52 PM, Robert Cimrman <<a href="mailto:cimrman3@ntc.zcu.cz">cimrman3@ntc.zcu.cz</a>> wrote:<br>

<br>
> Yes (in that thread), but it applies also adding/assembling vectors into a<br>
> global vector - this is just x[idx] += vals. I linked that discussion as that<br>
> was recent enough for me to recall it, but there were other.<br>
><br>
> Anyway, my point was that a having a function with the "adding" semantics in<br>
> NumPy would be handy.<br>
<br>
</div>x += numpy.bincount(idx, vals, minlength=len(x))<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Robert Kern<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br>