PyDynamic icon indicating copy to clipboard operation
PyDynamic copied to clipboard

Introduce an absolute tolerance into all assert_allclose() statements

Open mgrub opened this issue 10 months ago • 0 comments

This PR defines a variable "custom_atol=100*machine_epsilon" in the conftest.py and uses it in all assert_allclose statements, that did not already declare a (larger) absolute tolerance previously.

Motivation: numpy.testing.assert_allclose uses default values of rtol=1e-7 and atol=0. This is sometimes difficult to achieve if mathematically equivalent but numerically different routines are compared, especially for array entries close to zero. The proposed absolute tolerance should provide a good compromise between achievable numerical accuracy and detecting true deviation of arrays in tests.

mgrub avatar Apr 30 '24 08:04 mgrub