From 2c8cf305786c0aad364d937648e4062beb4ea912 Mon Sep 17 00:00:00 2001 From: "Robert T. McGibbon" Date: Tue, 29 Dec 2015 15:15:55 -0800 Subject: [PATCH 1/3] Add test case for gh-6896 --- numpy/linalg/tests/test_regression.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/numpy/linalg/tests/test_regression.py b/numpy/linalg/tests/test_regression.py index 54a67bce3ead..b876e8709f56 100644 --- a/numpy/linalg/tests/test_regression.py +++ b/numpy/linalg/tests/test_regression.py @@ -90,6 +90,20 @@ def test_svd_no_uv(self): assert_equal(np.linalg.matrix_rank(a), 1) assert_array_less(1, np.linalg.norm(a, ord=2)) + def test_eig_vs_eigh_above_560(self): + # gh-6896 + N = 560 + + A = np.arange(N*N).reshape(N, N) + A = A + A.T + + w1 = np.sort(linalg.eig(A)[0]) + w2 = np.sort(linalg.eigh(A, UPLO='U')[0]) + w3 = np.sort(linalg.eigh(A, UPLO='L')[0]) + assert_array_almost_equal(w1, w2) + assert_array_almost_equal(w1, w3) + + if __name__ == '__main__': run_module_suite() From 30dd41be7a141a68a9e1ecd66f9330dc230f9add Mon Sep 17 00:00:00 2001 From: Robert McGibbon Date: Mon, 4 Jan 2016 10:19:55 -0800 Subject: [PATCH 2/3] Add comment --- numpy/linalg/tests/test_regression.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/numpy/linalg/tests/test_regression.py b/numpy/linalg/tests/test_regression.py index b876e8709f56..e3d6dc45323d 100644 --- a/numpy/linalg/tests/test_regression.py +++ b/numpy/linalg/tests/test_regression.py @@ -91,7 +91,11 @@ def test_svd_no_uv(self): assert_array_less(1, np.linalg.norm(a, ord=2)) def test_eig_vs_eigh_above_560(self): - # gh-6896 + # Tests for an (apparent) error in linalg.eigh(... UPLO='L') + # with Accelerate (dsyevd) on OS X. The discrepancy only occurs + # with sufficiently large matricies, effects dsyevd when called + # directly from C as well. + # See gh-6896 N = 560 A = np.arange(N*N).reshape(N, N) From 74884778b436073cbe3e4def257268caf56ce5cb Mon Sep 17 00:00:00 2001 From: Robert McGibbon Date: Mon, 4 Jan 2016 10:59:13 -0800 Subject: [PATCH 3/3] Fix typo in comment from last commit --- numpy/linalg/tests/test_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpy/linalg/tests/test_regression.py b/numpy/linalg/tests/test_regression.py index e3d6dc45323d..c229fce33e6a 100644 --- a/numpy/linalg/tests/test_regression.py +++ b/numpy/linalg/tests/test_regression.py @@ -93,7 +93,7 @@ def test_svd_no_uv(self): def test_eig_vs_eigh_above_560(self): # Tests for an (apparent) error in linalg.eigh(... UPLO='L') # with Accelerate (dsyevd) on OS X. The discrepancy only occurs - # with sufficiently large matricies, effects dsyevd when called + # with sufficiently large matrices, and affects dsyevd when called # directly from C as well. # See gh-6896 N = 560