pysdic.Parametrization.decode#
- Parametrization.decode(p_o, *, dp=False, **kwargs)[source]#
Apply the decoding map \(P^{-1}\) to the output parameters \(\vec{p_o} \in \mathbb{R}^{n_o}\) to return the decoded parameters \(\vec{p_i} \in \mathbb{R}^{n_i}\).
\[\vec{p_i} = P^{-1}(\vec{p_o})\]Important
The decode method can only be used if the parametrization implements it (i.e.,
has_decodemust be True).The jacobian
dpcan only be computed if the parametrization supports it (i.e.,has_decode_dpmust be True).
Note
The relation between
decodeandencodeis given by the flagsis_left_invertible(\(P^{-1} \circ P = \text{Id}\)) andis_right_invertible(\(P \circ P^{-1} = \text{Id}\)).- Parameters:
p_o (ArrayLike) – Output parameters \(\vec{p_o}\) with shape \((n_o,)\) to which the decoding map will be applied.
dp (bool, optional (default:
False)) – Whether to compute the Jacobian with respect to the output parameters. (i.e., \(\mathbf{J}_p = \frac{\partial P^{-1}}{\partial \vec{p_o}}\)).**kwargs – Additional arguments passed to the underlying
_decodemethod.
- Returns:
Contains the decoded parameters accessible using the
pattribute with shape \((n_i,)\), and the Jacobian matrix with respect to the output parameters accessible using thejacobian_dpattribute with shape \((n_i, n_o)\) if computed, or None otherwise.- Return type:
Notes
The jacobian
dphas the following structure:jacobian_dp[0, 0] # ∂p_i1/∂p_o1 jacobian_dp[0, 1] # ∂p_i1/∂p_o2 jacobian_dp[1, 0] # ∂p_i2/∂p_o1 jacobian_dp[1, 1] # ∂p_i2/∂p_o2 jacobian_dp[i, j] # ∂p_ii/∂p_oj
Developers notes#
Subclasses must implement the
_decodemethod. This method should:Accept a NumPy array of shape \((n_o,)\).
Return \(\vec{p_i}\) Numpy array of shape \((n_i,)\) and optionally the Jacobian matrix with respect to the output parameters as a 2D array of shape \((n_i, n_o)\) if
dpis True, or None otherwise.
The shapes of the outputs of
_decodeare checked, and aRuntimeErroris raised if they do not match the expected shapes.