Skip to content

Commit

Permalink
Merge pull request #153 from GBillotey/ktol
Browse files Browse the repository at this point in the history
Allow tolerance for Xrange equality tests
  • Loading branch information
GBillotey authored Nov 5, 2023
2 parents 5a39b94 + 257b902 commit 7274e5a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/test_xrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,9 @@ def timing_abs2_complex(self, dtype=np.float64):
expected = op * np.conj(op)
t1 += time.time()

np.testing.assert_array_equal(e_res.to_standard(), expected)
ktol = 4.
np.testing.assert_allclose(e_res.to_standard(), expected,
rtol= ktol * np.finfo(dtype).eps)
if t1 == 0.:
return 0.
return t0 / t1
Expand All @@ -728,8 +730,10 @@ def timing_op1_complex(self, ufunc, dtype=np.float64):
t1 = - time.time()
expected = ufunc(op)
t1 += time.time()

np.testing.assert_array_equal(e_res.to_standard(), expected)

ktol = 4.
np.testing.assert_allclose(e_res.to_standard(), expected,
rtol= ktol * np.finfo(dtype).eps)
if t1 == 0.:
return 0.
return t0 / t1
Expand Down Expand Up @@ -759,11 +763,12 @@ def timing_op2_complex(self, ufunc, dtype=np.float64):
expected = ufunc(op1, op2)
t1 += time.time()

np.testing.assert_array_equal(e_res.to_standard(), expected)
ktol = 4.
np.testing.assert_allclose(e_res.to_standard(), expected,
rtol= ktol * np.finfo(dtype).eps)

if t1 == 0.:
return 0.
print("\ntiming", ufunc, dtype, t0, t1, t0 / t1)
return t0 / t1


Expand Down

0 comments on commit 7274e5a

Please sign in to comment.