summaryrefslogtreecommitdiff
path: root/numpy/linalg/linalg.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2013-10-01 12:44:48 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2013-10-01 16:21:42 +0200
commit069ecaecd09a97c54dfd1b4acb3a3721f9e91aa9 (patch)
tree3cc4a855350d75df3377448501290f7cc8c7d417 /numpy/linalg/linalg.py
parent74abfa27763f76cbce0ec1a1763f0687e5d8a4c0 (diff)
downloadnumpy-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.py9
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