method
matrix.put(indices, values, mode='raise')
#
Set a.flat[n]=values[n] for all n in indices.
Refer to
numpy.put
for full documentation.