bayespy.utils.misc.put(x, indices, y, axis=-1, ufunc=<ufunc 'add'>)[source]

A kind of inverse mapping of np.take

In a simple, the operation can be thought as:

x[indices] += y

with the exception that all entries of y are used instead of just the first occurence corresponding to a particular element. That is, the results are accumulated, and the accumulation function can be changed by providing ufunc. For instance, np.multiply corresponds to:

x[indices] *= y

Whereas np.take picks indices along an axis and returns the resulting array, put similarly picks indices along an axis but accumulates the given values to those entries.