Simple Version: if I do this:
import numpy as np a = np.zeros(2) a[[1, 1]] += np.array([1, 1])
I get [0, 1] a
[0, 1]
This is what the at method of NumPy ufuncs is for:
output = numpy.zeros(size) numpy.add.at(output, a[a.cond].ix, a[a.cond].val)