I'm having a numpy ndarray where I would like to check if each row vector is monotonically increasing.
Example:
a = np.asarray([[1,2,3],[1,5,7],[4,3,6]])
monotonically_increasing(a)
Expected return:
[True, True, False]
I'm not entirely sure how to efficiently do this, since the matrices are expected to be quite large (~1000x1000), and was hoping for some help.
np.all(a[:, 1:] >= a[:, :-1], axis=1)
– Poirer