pysdic.ComposedTransformation._invert#
- ComposedTransformation._invert(x_o, *, dx=False, dp=False, kwargs=None, bypass_dp=None)[source]#
Apply the inverse of the composition of transformations to the output points \(\vec{x_o}\) to produce the input points \(\vec{x_i}\).
\[\vec{x_i} = T_1^{-1}(T_2^{-1}(...T_n^{-1}(\vec{x_o})...))\]Lets \(\vec{z}_n = \vec{x_o}\) and \(\vec{z}_{k-1} = T_k^{-1}(\vec{z}_k; \vec{p}_k)\) be the intermediate points. The Jacobian with respect to the output points is computed using the chain rule across the sequence of transformations in reverse:
\[\mathbf{J}_x = \frac{\partial T_1^{-1}}{\partial \vec{z}_1} \cdot ... \cdot \frac{\partial T_{n-1}^{-1}}{\partial \vec{z}_{n-1}} \cdot \frac{\partial T_n^{-1}}{\partial \vec{x_o}}\]The Jacobian with respect to the parameters is the concatenation of the Jacobians with respect to the parameters of each transformation, propagated through the inverse maps applied after it:
\[\mathbf{J}_p = \begin{bmatrix} \frac{\partial T^{-1}}{\partial \vec{p}_1} & \frac{\partial T^{-1}}{\partial \vec{p}_2} & \dots & \frac{\partial T^{-1}}{\partial \vec{p}_n} \end{bmatrix} \quad \text{with} \quad \frac{\partial T^{-1}}{\partial \vec{p}_k} = \frac{\partial T_1^{-1}}{\partial \vec{z}_1} \cdot ... \cdot \frac{\partial T_{k-1}^{-1}}{\partial \vec{z}_{k-1}} \cdot \frac{\partial T_k^{-1}}{\partial \vec{p}_k}\]- Parameters:
x_o (numpy.ndarray) – The output points to invert, with shape \((n_\text{points}, n_o)\) where \(n_o\) is the output dimension of the last transformation in the composition.
dx (bool, optional (default:
False)) – If True, compute the Jacobian with respect to the output points.dp (bool, optional (default:
False)) – If True, compute the Jacobian with respect to the parameters.kwargs (Optional[List[Optional[Dict[str, Any]]]], optional (default:
None)) – A list of dictionaries containing additional keyword arguments to pass to each transformation’s invert method. The list must have the same length as the number of transformations in the composition, in the order \([T_1, T_2, ..., T_n]\) (the same order as for applying, even if the inversion is applied in reverse).Noneelements are replaced by empty dictionaries.bypass_dp (Optional[Sequence[bool]], optional (default:
None)) – A sequence of booleans with the same length as the number of transformations, in the order \([T_1, T_2, ..., T_n]\). Ifdp=True, the Jacobian with respect to the parameters of the transformations withTrueis not computed (nor propagated) and its columns injacobian_dpare filled with NaN. If None, no Jacobian is bypassed. Ignored ifdp=False.
- Returns:
numpy.ndarray – The inverted input points, with shape \((n_\text{points}, n_i)\) where \(n_i\) is the input dimension of the first transformation in the composition.
Optional[numpy.ndarray] – The Jacobian matrix with respect to the output points if
dx=True, with shape \((n_\text{points}, n_i, n_o)\), or None ifdx=False.Optional[numpy.ndarray] – The Jacobian matrix with respect to the parameters if
dp=True, with shape \((n_\text{points}, n_i, n_p)\), or None ifdp=False, where \(n_p\) is the total number of parameters of the composition.
- Return type: