newton.math.vec_allclose#

newton.math.vec_allclose(a, b, rtol=1e-5, atol=1e-8)[source]#

Check whether two Warp vectors are element-wise equal within a tolerance.

Uses the same criterion as NumPy’s allclose: abs(a[i] - b[i]) <= atol + rtol * abs(b[i]) for every element.

Parameters:
  • a (Any) – First vector.

  • b (Any) – Second vector.

  • rtol (float) – Relative tolerance.

  • atol (float) – Absolute tolerance.

Returns:

True if all elements satisfy the tolerance, False otherwise.

Return type:

bool