diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2008-04-27 18:44:47 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2008-04-27 18:44:47 +0000 |
commit | 06c0d0e97c7781cc81be38c1d3124890822b303f (patch) | |
tree | c0e35437cb0b6b29070cc01b08bf9be8b7f136ec /numpy/linalg/linalg.py | |
parent | 8d915a55c5ecbca15ebaf13584b0c255d22768a1 (diff) | |
download | numpy-06c0d0e97c7781cc81be38c1d3124890822b303f.tar.gz |
Fix test of lstsqr to work with matrix tests.
Fix lstsq
Diffstat (limited to 'numpy/linalg/linalg.py')
-rw-r--r-- | numpy/linalg/linalg.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index a557af875..ea4585dfa 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -1147,10 +1147,10 @@ def lstsq(a, b, rcond=-1): """ import math - a = _makearray(a) + a, _ = _makearray(a) b, wrap = _makearray(b) - one_eq = len(b.shape) == 1 - if one_eq: + is_1d = len(b.shape) == 1 + if is_1d: b = b[:, newaxis] _assertRank2(a, b) m = a.shape[0] @@ -1199,7 +1199,7 @@ def lstsq(a, b, rcond=-1): if results['info'] > 0: raise LinAlgError, 'SVD did not converge in Linear Least Squares' resids = array([], t) - if one_eq: + if is_1d: x = array(ravel(bstar)[:n], dtype=result_t, copy=True) if results['rank'] == n and m > n: resids = array([sum((ravel(bstar)[n:])**2)], dtype=result_t) |