diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2013-10-01 12:44:48 +0200 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2013-10-01 16:21:42 +0200 |
commit | 069ecaecd09a97c54dfd1b4acb3a3721f9e91aa9 (patch) | |
tree | 3cc4a855350d75df3377448501290f7cc8c7d417 /numpy/linalg/linalg.py | |
parent | 74abfa27763f76cbce0ec1a1763f0687e5d8a4c0 (diff) | |
download | numpy-069ecaecd09a97c54dfd1b4acb3a3721f9e91aa9.tar.gz |
BUG: Allos linalg.solve to handle zero equations.
This was previously correct, but the special case was missing
since the gufunc code cannot handle it.
Diffstat (limited to 'numpy/linalg/linalg.py')
-rw-r--r-- | numpy/linalg/linalg.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 78e487a25..a1bb842ee 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -368,10 +368,11 @@ def solve(a, b): gufunc = _umath_linalg.solve1 else: - if a.shape[-1] == 0 and b.shape[-2] == 0: - a = a.reshape(a.shape[:-1] + (1,)) - bc = broadcast(a, b) - return wrap(empty(bc.shape, dtype=result_t)) + if b.size == 0: + if (a.shape[-1] == 0 and b.shape[-2] == 0) or b.shape[-1] == 0: + a = a[:,:1].reshape(a.shape[:-1] + (1,)) + bc = broadcast(a, b) + return wrap(empty(bc.shape, dtype=result_t)) gufunc = _umath_linalg.solve |