allclose

compas.geometry.allclose(l1, l2, tol=1e-05)[source]

Returns True if two lists are element-wise equal within a tolerance.

Parameters
  • l1 (list of float) – The first list of values.

  • l2 (list of float) – The second list of values.

  • tol (float, optional) – The tolerance for comparing values. Default is 1e-05.

Notes

The function is similar to NumPy’s allclose function 1.

Examples

>>> allclose([0.1, 0.2, 0.3, 0.4], [0.1, 0.20001, 0.3, 0.4])
True
>>> allclose([0.1, 0.2, 0.3, 0.4], [0.1, 0.20001, 0.3, 0.4], tol=1e-6)
False

References

1

https://docs.scipy.org/doc/numpy/reference/generated/numpy.allclose.html