In other words, I want to do something like
A[[-1, 0, 1], [2, 3, 4]] += np.ones((3, 3))
instead of
A[-1:3, 2:5] += np.ones((1, 3))
A[0:2, 2:5] += np.ones((2, 3))
In other words, I want to do something like
A[[-1, 0, 1], [2, 3, 4]] += np.ones((3, 3))
instead of
A[-1:3, 2:5] += np.ones((1, 3))
A[0:2, 2:5] += np.ones((2, 3))
If I understand correctly, you can do what you want to do with the following:
A[[[-1],[0],[1]],[2,3,4]] += np.ones((3, 3))
However, the numpy folks made a function, ix_, to make it a little bit easier:
A[np.ix_([-1,0,1],[2,3,4])] += np.ones((3, 3))
I hope that helps.