pysdic.Parametrization.check_decode_dp#

Parametrization.check_decode_dp(p_o, *, eps=1e-06, rtol=1e-05, atol=1e-08, raise_error=False, **kwargs)[source]#

Check the Jacobian of the decode method against central finite differences at the given output parameters \(\vec{p_o}\).

\[\frac{\partial P^{-1}}{\partial p_{o,k}} \approx \frac{P^{-1}(\vec{p_o} + h_k \vec{e_k}) - P^{-1}(\vec{p_o} - h_k \vec{e_k})}{2 h_k}\]

with \(h_k = \varepsilon \max(1, |p_{o,k}|)\).

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 check the Jacobian.

  • eps (float, optional (default: 1e-6)) – The relative step \(\varepsilon\) of the finite differences.

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

  • **kwargs – Additional arguments passed to the underlying _decode method.

Returns:

True if the analytical Jacobian matches the finite differences, False otherwise.

Return type:

bool