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 NumPy’s allclose tolerance criterion for finite elements: abs(a[i] - b[i]) <= atol + rtol * abs(b[i]). NaN values are never close. Infinite values are close only when they have the same sign.

Parameters:
  • a (Any) – First vector.

  • b (Any) – Second vector.

  • rtol (float) – Relative tolerance.

  • atol (float) – Absolute tolerance.

Returns:

True if all elements are close, False otherwise.

Return type:

bool