diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-04-20 20:31:59 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-04-21 11:13:52 -0700 |
commit | 3a166395409d92211c56cfeff44adc7f485db9ec (patch) | |
tree | ead55dbb3797b60a6b3818dca0e49078f532b0f1 | |
parent | b68bb43840368549c12801b5142a5171bb7c0139 (diff) | |
download | numpy-3a166395409d92211c56cfeff44adc7f485db9ec.tar.gz |
MAINT: Prepare lstsq for vectorization, by using the last indices in shape, not the first
-rw-r--r-- | numpy/linalg/linalg.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 1942d6358..6139e40c4 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -2007,10 +2007,9 @@ def lstsq(a, b, rcond="warn"): b = b[:, newaxis] _assertRank2(a, b) _assertNoEmpty2d(a, b) # TODO: relax this constraint - m = a.shape[0] - n = a.shape[1] - n_rhs = b.shape[1] - if m != b.shape[0]: + m, n = a.shape[-2:] + m2, n_rhs = b.shape[-2:] + if m != m2: raise LinAlgError('Incompatible dimensions') t, result_t = _commonType(a, b) |