pysdic.IdentityTransformation#
IdentityTransformation class#
- class IdentityTransformation(*args, **kwargs)[source]#
Bases:
TransformationThe identity transformation \(T\) that maps input points to output points without any change.
\[\vec{x_o} = T(\vec{x_i}) = \vec{x_i}\]This transformation has no parameters and serves as a neutral element in transformation compositions.
When the input and output dimensions differ, the transformation is the canonical projection or embedding between the two spaces:
If \(n_o < n_i\), the last \(n_i - n_o\) coordinates are dropped (projection).
If \(n_o > n_i\), the last \(n_o - n_i\) coordinates are set to zero (embedding).
\[\begin{split}\vec{x_o}[k] = \begin{cases} \vec{x_i}[k] & \text{if } k < \min(n_i, n_o) \\ 0 & \text{otherwise} \end{cases}\end{split}\]The inverse map \(T^{-1}\) is the identity transformation from \(\mathbb{R}^{n_o}\) to \(\mathbb{R}^{n_i}\). It is a left inverse if \(n_i \leq n_o\) and a right inverse if \(n_i \geq n_o\).
The Jacobian with respect to the points is the constant matrix \(\mathbf{J}_x = \mathbf{I}_{n_o \times n_i}\) (the identity matrix truncated or padded with zeros), and the Jacobian with respect to the parameters is empty with shape \((n_o, 0)\).
See also
Class
pysdic.Transformationfor the base class of transformations.
- Parameters:
input_dim (Integral) – The dimension \(n_i\) of the input points (strictly positive).
output_dim (Optional[Integral], optional (default:
None)) – The dimension \(n_o\) of the output points (strictly positive). If None, the output dimension is equal to the input dimension.parameters (Optional[ArrayLike])
Examples
The identity in 2D and the embedding of 2D points into 3D:
identity = IdentityTransformation(input_dim=2) identity.apply([[1.0, 2.0]]).x # array([[1., 2.]]) embedding = IdentityTransformation(input_dim=2, output_dim=3) embedding.apply([[1.0, 2.0]]).x # array([[1., 2., 0.]]) embedding.invert([[1.0, 2.0, 3.0]]).x # array([[1., 2.]])
Instantiation#
The IdentityTransformation class is instantiated directly with its constructor:
Identity of \(\mathbb{R}^{n_i}\):
IdentityTransformation(input_dim=n_i).Projection or embedding from \(\mathbb{R}^{n_i}\) to \(\mathbb{R}^{n_o}\):
IdentityTransformation(input_dim=n_i, output_dim=n_o).
Implemented methods and attributes#
The following sections provide an overview of the attributes and methods defined
in the pysdic.IdentityTransformation class.
Attributes#
The pysdic.IdentityTransformation has no parameters: parameters is an empty vector.
The pysdic.IdentityTransformation defines the following attributes:
[Get] the input dimension \(n_i\) of the transformation. |
|
[Get] the output dimension \(n_o\) of the transformation. |
Performing Projections#
Use the apply and invert methods from
pysdic.Transformation to perform the transformation:
apply: mapsinput_points(\(n_i\)) →output_points(\(n_o\)).invert: mapsoutput_points(\(n_o\)) →input_points(\(n_i\)).
Jacobians with respect to the input points and parameters
can be computed by enabling the dx and dp flags:
dx=True: compute ∂output_points / ∂input_points (truncated or zero-padded identity matrix)dp=True: compute ∂output_points / ∂parameters (empty)
|
Apply the identity transformation from \(\mathbb{R}^{n_i}\) to \(\mathbb{R}^{n_o}\). |
|
Apply the identity transformation from \(\mathbb{R}^{n_o}\) to \(\mathbb{R}^{n_i}\). |