pysdic.Parametrization.check_right_invertible#

Parametrization.check_right_invertible(p_o, *, check_dp=False, rtol=1e-05, atol=1e-08, raise_error=False, encode_kwargs=None, decode_kwargs=None)[source]#

Check numerically that the decode method is a right inverse of the encode method at the given output parameters \(\vec{p_o}\).

\[P(P^{-1}(\vec{p_o})) = \vec{p_o}\]

If check_dp is True, the consistency of the Jacobians is also checked using the chain rule:

\[\frac{\partial P}{\partial \vec{p_i}}(P^{-1}(\vec{p_o})) \cdot \frac{\partial P^{-1}}{\partial \vec{p_o}}(\vec{p_o}) = \mathbf{I}_{n_o}\]

Note

This check is only valid at the given point. It is recommended to perform it at several points of the parametric space.

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

  • check_dp (bool, optional (default: False)) – If True, also check the consistency of the Jacobians of encode and decode.

  • 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.

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

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

Returns:

True if the decode method behaves as a right inverse at the given point, False otherwise.

Return type:

bool