On Fri, Jun 11, 2010 at 22:06,  <[email protected]> wrote:
> Hi all,
>
> I recently needed to a simple array procedure that I assumed would be
> supported (and almost is) but was surprised to find some limitations.
>
> I've got two arrays, A and B, and some array of indices, I, and I want to
> perform the operation
>
> A[I] += B
>
> where I and B have the same dimensions.
>
> This works fine provided there are no repeated indices in I, but otherwise
> only the last of each repeated index is used. I've written a C function I
> call PutSum that does what I want, but I figured there must something
> already lying around. Is there?

numpy.bincount()

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to