diff options
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 |