summaryrefslogtreecommitdiff
path: root/numpy/linalg/tests/test_linalg.py
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2013-04-12 18:16:31 +0300
committerPauli Virtanen <pav@iki.fi>2013-04-12 18:59:39 +0300
commit1b3834d7b59da2e809d320992c632697355d63b6 (patch)
treebcf267e61e7ff3ff71f9d0353009ec1f13eb9bed /numpy/linalg/tests/test_linalg.py
parent20cc77a1a466192fb2ea11f61f6cbf678f266b87 (diff)
downloadnumpy-1b3834d7b59da2e809d320992c632697355d63b6.tar.gz
BUG: linalg: make umath_linalg to track errors from all inner loop iterations
This ensures that the FP invalid flag always reflects the return code from LAPACK. Fixes a bug in 63a8aef81 where umath_linalg raises a warning only if the error occurs in the last iteration of the ufunc inner loop.
Diffstat (limited to 'numpy/linalg/tests/test_linalg.py')
-rw-r--r--numpy/linalg/tests/test_linalg.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py
index 0a6f8f4ca..af9bf884d 100644
--- a/numpy/linalg/tests/test_linalg.py
+++ b/numpy/linalg/tests/test_linalg.py
@@ -654,5 +654,18 @@ def test_byteorder_check():
assert_array_equal(res, routine(sw_arr))
+def test_generalized_raise_multiloop():
+ # It should raise an error even if the error doesn't occur in the
+ # last iteration of the ufunc inner loop
+
+ invertible = np.array([[1, 2], [3, 4]])
+ non_invertible = np.array([[1, 1], [1, 1]])
+
+ x = np.zeros([4, 4, 2, 2])[1::2]
+ x[...] = invertible
+ x[0,0] = non_invertible
+
+ assert_raises(np.linalg.LinAlgError, np.linalg.inv, x)
+
if __name__ == "__main__":
run_module_suite()