Mistake: the shape tells you the rank
“Both matrices are
(3, 3), so both have rank 3.”
full = np.array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])
flat = np.array([[1., 2., 3.], [2., 4., 6.], [3., 6., 9.]])
assert full.shape == flat.shape == (3, 3)
assert np.linalg.matrix_rank(full) == 3
assert np.linalg.matrix_rank(flat) == 1
Same shape, same order, ranks 3 and 1. Every row of flat is a multiple of the first. Order is the number of axes and the shape gives it away; rank counts independent directions and has to be computed.