summaryrefslogtreecommitdiff
path: root/numpy/linalg/linalg.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-02-24 16:46:58 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-02-24 16:46:58 +0000
commit48783e5ceb7f60c33db81ab72e5024f42b220990 (patch)
tree2284b780e521418b0e73fd7283403d3e7e28da50 /numpy/linalg/linalg.py
parent5f5ccecbfc116284ed8c8d53cd8b203ceef5f7c7 (diff)
downloadnumpy-48783e5ceb7f60c33db81ab72e5024f42b220990.tar.gz
MAINT: replace len(x.shape) with x.ndim
Diffstat (limited to 'numpy/linalg/linalg.py')
-rw-r--r--numpy/linalg/linalg.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index 6002c63b9..84e450b12 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -192,15 +192,15 @@ def _fastCopyAndTranspose(type, *arrays):
def _assertRank2(*arrays):
for a in arrays:
- if len(a.shape) != 2:
+ if a.ndim != 2:
raise LinAlgError('%d-dimensional array given. Array must be '
- 'two-dimensional' % len(a.shape))
+ 'two-dimensional' % a.ndim)
def _assertRankAtLeast2(*arrays):
for a in arrays:
- if len(a.shape) < 2:
+ if a.ndim < 2:
raise LinAlgError('%d-dimensional array given. Array must be '
- 'at least two-dimensional' % len(a.shape))
+ 'at least two-dimensional' % a.ndim)
def _assertSquareness(*arrays):
for a in arrays:
@@ -231,7 +231,7 @@ def tensorsolve(a, b, axes=None):
It is assumed that all indices of `x` are summed over in the product,
together with the rightmost indices of `a`, as is done in, for example,
- ``tensordot(a, x, axes=len(b.shape))``.
+ ``tensordot(a, x, axes=b.ndim)``.
Parameters
----------
@@ -1917,7 +1917,7 @@ def lstsq(a, b, rcond=-1):
import math
a, _ = _makearray(a)
b, wrap = _makearray(b)
- is_1d = len(b.shape) == 1
+ is_1d = b.ndim == 1
if is_1d:
b = b[:, newaxis]
_assertRank2(a, b)