pysdic.Parametrization.check_left_invertible#

Parametrization.check_left_invertible(p_i, *, 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 left inverse of the encode method at the given input parameters \(\vec{p_i}\).

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

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

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

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_i (ArrayLike) – Input parameters \(\vec{p_i}\) with shape \((n_i,)\) 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 left inverse at the given point, False otherwise.

Return type:

bool