From 48783e5ceb7f60c33db81ab72e5024f42b220990 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Fri, 24 Feb 2017 16:46:58 +0000 Subject: MAINT: replace len(x.shape) with x.ndim --- numpy/matrixlib/defmatrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/matrixlib/defmatrix.py') diff --git a/numpy/matrixlib/defmatrix.py b/numpy/matrixlib/defmatrix.py index 6c7640cb8..bd14846c6 100644 --- a/numpy/matrixlib/defmatrix.py +++ b/numpy/matrixlib/defmatrix.py @@ -169,7 +169,7 @@ def matrix_power(M, n): """ M = asanyarray(M) - if len(M.shape) != 2 or M.shape[0] != M.shape[1]: + if M.ndim != 2 or M.shape[0] != M.shape[1]: raise ValueError("input must be a square array") if not issubdtype(type(n), int): raise TypeError("exponent must be an integer") -- cgit v1.2.1