diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-02-24 01:23:37 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-02-24 01:28:44 +0000 |
commit | ad8d6eb4942c68a8123a94d5dd73bdb246775690 (patch) | |
tree | eea8d59cb58dab69e4fe758ede7462ac962d2d35 /numpy/linalg/tests | |
parent | 5f5ccecbfc116284ed8c8d53cd8b203ceef5f7c7 (diff) | |
download | numpy-ad8d6eb4942c68a8123a94d5dd73bdb246775690.tar.gz |
ENH: allow argument to matrix_rank to be stacked
Fixes #5905
Diffstat (limited to 'numpy/linalg/tests')
-rw-r--r-- | numpy/linalg/tests/test_linalg.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py index fc4f98ed7..9e29b343e 100644 --- a/numpy/linalg/tests/test_linalg.py +++ b/numpy/linalg/tests/test_linalg.py @@ -1261,8 +1261,9 @@ class TestMatrixRank(object): yield assert_equal, matrix_rank(np.zeros((4,))), 0 # accepts array-like yield assert_equal, matrix_rank([1]), 1 - # greater than 2 dimensions raises error - yield assert_raises, TypeError, matrix_rank, np.zeros((2, 2, 2)) + # greater than 2 dimensions treated as stacked matrices + ms = np.array([I, np.eye(4), np.zeros((4,4))]) + yield assert_equal, matrix_rank(ms), np.array([3, 4, 0]) # works on scalar yield assert_equal, matrix_rank(1), 1 |