Skip to content

Commit 50d9029

Browse files
committed
rtol->atol
absolute tolerance is likely a better fit than a relative tolerance check.
1 parent 449c32d commit 50d9029

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

tests/test_pydiso.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_solver(A, matrix_type):
9393
x2 = solver.solve(b)
9494

9595
eps = np.finfo(dtype).eps
96-
np.testing.assert_allclose(x, x2, rtol=2E4*eps)
96+
np.testing.assert_allclose(x, x2, atol=1E3*eps)
9797

9898
@pytest.mark.parametrize("A, matrix_type", inputs)
9999
def test_transpose_solver(A, matrix_type):
@@ -108,7 +108,7 @@ def test_transpose_solver(A, matrix_type):
108108
x2 = solver.solve(b, transpose=True)
109109

110110
eps = np.finfo(dtype).eps
111-
np.testing.assert_allclose(x, x2, rtol=2E4*eps)
111+
np.testing.assert_allclose(x, x2, atol=1E3*eps)
112112

113113
def test_multiple_RHS():
114114
A = A_real_dict["real_symmetric_positive_definite"]
@@ -119,8 +119,7 @@ def test_multiple_RHS():
119119
x2 = solver.solve(b)
120120

121121
eps = np.finfo(np.float64).eps
122-
rel_err = np.linalg.norm(x-x2)/np.linalg.norm(x)
123-
assert rel_err < 1E3*eps
122+
np.testing.assert_allclose(x, x2, atol=1E3*eps)
124123

125124

126125
def test_matrix_type_errors():

0 commit comments

Comments
 (0)