Comment on NumPy 1.20parentComments−montebicyclelo5yAlternatively you could use flat:a = np.array([[1,2,3],[1,9,3],[1,2,3]])idx = np.argmax(a)a.flat[idx] # 9−6gvONxR4sf7o5yDoes that work the same way with strided arrays?−montebicyclelo5yAssuming you mean what I think you mean, it does work.e.g. a[::2, ::3].flat[idx], where idx is from 0 to width*height of the view(idx can also be a NumPy array, for getting multiple values)
Comments
Alternatively you could use flat:
a = np.array([[1,2,3],[1,9,3],[1,2,3]])
idx = np.argmax(a)
a.flat[idx] # 9
Does that work the same way with strided arrays?
Assuming you mean what I think you mean, it does work.
e.g. a[::2, ::3].flat[idx], where idx is from 0 to width*height of the view
(idx can also be a NumPy array, for getting multiple values)