pysdic.Transformation.check_right_invertible#

Transformation.check_right_invertible(x_o, *, check_dx=False, check_dp=False, rtol=1e-05, atol=1e-08, raise_error=False, apply_kwargs=None, invert_kwargs=None)[source]#

Check numerically that the invert method is a right inverse of the apply method at the given output points \(\vec{x_o}\).

\[T(T^{-1}(\vec{x_o})) = \vec{x_o}\]

If check_dx is True, the consistency of the Jacobians with respect to the points is also checked using the chain rule:

\[\frac{\partial T}{\partial \vec{x_i}}(T^{-1}(\vec{x_o})) \cdot \frac{\partial T^{-1}}{\partial \vec{x_o}}(\vec{x_o}) = \mathbf{I}_{n_o}\]

If check_dp is True, the consistency of the Jacobians with respect to the parameters is also checked by differentiating the identity with respect to \(\vec{p}\):

\[\frac{\partial T}{\partial \vec{x_i}}(T^{-1}(\vec{x_o})) \cdot \frac{\partial T^{-1}}{\partial \vec{p}}(\vec{x_o}) + \frac{\partial T}{\partial \vec{p}}(T^{-1}(\vec{x_o})) = \mathbf{0}\]

Note

This check is only valid at the given points. It is recommended to perform it on points covering the domain of interest.

Parameters:
  • x_o (ArrayLike) – Output points \(\vec{x_o}\) with shape \((\dots, n_o)\) at which to perform the check.

  • check_dx (bool, optional (default: False)) – If True, also check the consistency of the Jacobians with respect to the points.

  • check_dp (bool, optional (default: False)) – If True, also check the consistency of the Jacobians with respect to the parameters.

  • rtol (float, optional (default: 1e-5)) – The relative tolerance of the comparison (see numpy.allclose).

  • atol (float, optional (default: 1e-8)) – The absolute tolerance of the comparison (see numpy.allclose).

  • raise_error (bool, optional (default: False)) – If True, raise an AssertionError with the maximum error if the check fails.

  • apply_kwargs (Optional[Dict[str, Any]], optional (default: None)) – Additional arguments passed to the underlying _apply method.

  • invert_kwargs (Optional[Dict[str, Any]], optional (default: None)) – Additional arguments passed to the underlying _invert method.

Returns:

True if the invert method behaves as a right inverse at the given points, False otherwise.

Return type:

bool