99 set_mkl_pardiso_threads ,
1010)
1111import pytest
12+ import sys
1213
1314np .random .seed (12345 )
1415n = 40
3940 }
4041
4142
43+ @pytest .mark .xfail (sys .platform == "darwin" , reason = "Unexpected Thread bug in third party library" )
4244def test_thread_setting ():
4345 n1 = get_mkl_max_threads ()
4446 n2 = get_mkl_pardiso_max_threads ()
@@ -93,8 +95,22 @@ def test_solver(A, matrix_type):
9395 x2 = solver .solve (b )
9496
9597 eps = np .finfo (dtype ).eps
96- rel_err = np .linalg .norm (x - x2 )/ np .linalg .norm (x )
97- assert rel_err < 1E3 * eps
98+ np .testing .assert_allclose (x , x2 , atol = 1E3 * eps )
99+
100+ @pytest .mark .parametrize ("A, matrix_type" , inputs )
101+ def test_transpose_solver (A , matrix_type ):
102+ dtype = A .dtype
103+ if np .issubdtype (dtype , np .complexfloating ):
104+ x = xc .astype (dtype )
105+ else :
106+ x = xr .astype (dtype )
107+ b = A .T @ x
108+
109+ solver = Solver (A , matrix_type = matrix_type )
110+ x2 = solver .solve (b , transpose = True )
111+
112+ eps = np .finfo (dtype ).eps
113+ np .testing .assert_allclose (x , x2 , atol = 1E3 * eps )
98114
99115def test_multiple_RHS ():
100116 A = A_real_dict ["real_symmetric_positive_definite" ]
@@ -105,8 +121,7 @@ def test_multiple_RHS():
105121 x2 = solver .solve (b )
106122
107123 eps = np .finfo (np .float64 ).eps
108- rel_err = np .linalg .norm (x - x2 )/ np .linalg .norm (x )
109- assert rel_err < 1E3 * eps
124+ np .testing .assert_allclose (x , x2 , atol = 1E3 * eps )
110125
111126
112127def test_matrix_type_errors ():
@@ -119,6 +134,7 @@ def test_matrix_type_errors():
119134 solver = Solver (A , matrix_type = "real_symmetric_positive_definite" )
120135
121136
137+
122138def test_rhs_size_error ():
123139 A = A_real_dict ["real_symmetric_positive_definite" ]
124140 solver = Solver (A , "real_symmetric_positive_definite" )
0 commit comments