-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
As reported by @Aleksanaa in NixOS/nixpkgs#426180, there is a slight precision error on Darwin (macOS) systems in test_polydiff probably due to a different BLAS backend:
nodes = dmat.nodes
assert np.allclose(nodes[0], dmat.xmin)
assert np.allclose(nodes[-1], dmat.xmax)
func = nodes**2
dfunc = 2 * nodes
d2func = 2.0
d1_cheb = dmat.at_order(1) @ func
d2_cheb = dmat.at_order(2) @ func
d3_cheb = dmat.at_order(3) @ func
assert np.allclose(d1_cheb, dfunc)
assert np.allclose(d2_cheb, d2func)
> assert np.allclose(d3_cheb, 0.0, atol=1e-6)
E assert False
E + where False = (array([-1.27562089e-07, -3.15194484e-08, 3.28873284e-09, 8.14907253e-10,\n -2.24190444e-10, -3.31965566e-11, 6...9, 4.74392436e-09,\n -5.41331246e-09, 1.37370080e-08, -8.38190317e-09, -9.08970833e-07,\n -1.10268593e-06]), 0.0, atol=1e-06)
E + where = np.allclose
tests/test_polydiff.py:49: AssertionError
=========================== short test summary info ============================
FAILED tests/test_polydiff.py::test_cheb_scaled - assert False
========================= 1 failed, 7 passed in 0.52s ==========================
This is not a big deal and I cannot test it on my system but this could probably be fixed using something like
# Platform-aware tolerance
atol = 1e-6
if platform.system() == "Darwin":
atol = ...
# ...
assert np.allclose(d3_cheb, 0.0, atol=atol)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels