summaryrefslogtreecommitdiff
path: root/numpy/linalg/linalg.py
diff options
context:
space:
mode:
authorJulian Taylor <juliantaylor108@gmail.com>2017-02-25 16:39:43 +0100
committerGitHub <noreply@github.com>2017-02-25 16:39:43 +0100
commiteb271d95c0c9f3821009330d858a261b4b861bfe (patch)
tree4e076b45c91eacce30cdbdc0f3b80cad1118dcdd /numpy/linalg/linalg.py
parente9246860480b6c909e6e00c1cd4371b0e5fee1ce (diff)
parent38ce8097749ad69494926036250ed5b2de66184c (diff)
downloadnumpy-eb271d95c0c9f3821009330d858a261b4b861bfe.tar.gz
Merge pull request #8685 from eric-wieser/shape-to-ndim
ENH: add dtype.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)