polynomials_on_simplices.linalg.vector_space_projection module¶
Projection routines.
-
interval_projection
(p, interval)[source]¶ Project a point in \(\mathbb{R}\) to an interval [a, b].
Parameters: - p – Point to project (scalar).
- interval – Interval to project to (pair of two scalars).
Returns: Point in [a, b] closest to p (scalar).
-
subspace_projection_map
(basis, origin=None)[source]¶ Generate the affine map \(P_V : \mathbb{R}^n \to \mathbb{R}^n, P(x) = Ax + b\) which projects a point \(x \in \mathbb{R}^n\) onto an m-dimensional vector subspace V of \(\mathbb{R}^n, m \leq n\).
We have
\[A = BB^T \in \mathbb{R}^{n \times n},\]\[b = (I - BB^T) o_V \in \mathbb{R}^n,\]where \(B\) is the Gram-Schmidt orthonormalization of the basis spanning V and \(o_V\) is the origin of V.
Parameters: - basis (Element in \(\mathbb{R}^{n \times m}\).) – Basis for the subspace V (matrix with the basis vectors as columns).
- origin (Element in \(\mathbb{R}^n\).) – Origin of the subspace V. Optional, the n-dimensional zero-vector is used if not specified.
Returns: Function which takes an n-dimensional vector as input and returns an n-dimensional vector in V.
Return type: Callable \(P_V(x)\).
-
subspace_projection_transformation
(basis, origin=None)[source]¶ Generate the affine transformation \(P_V : \mathbb{R}^n \to \mathbb{R}^n, P(x) = Ax + b\) which projects a point \(x \in \mathbb{R}^n\) onto an m-dimensional vector subspace V of \(\mathbb{R}^n, m \leq n\).
We have
\[A = BB^T \in \mathbb{R}^{n \times n},\]\[b = (I - BB^T) o_V \in \mathbb{R}^n,\]where \(B\) is the Gram-Schmidt orthonormalization of the basis spanning V and \(o_V\) is the origin of V.
Parameters: - basis (Element in \(\mathbb{R}^{n \times m}\).) – Basis for the subspace V (matrix with the basis vectors as columns).
- origin (Element in \(\mathbb{R}^n\).) – Origin of the subspace V. Optional, the n-dimensional zero-vector is used if not specified.
Returns: Tuple of A and b.
-
vector_oblique_projection_2
(a, b, c)[source]¶ Projection of vector a on b, along vector c (oblique projection). Only applicable to two dimensional vectors.
Parameters: - a – Vector to project.
- b – Vector to project onto.
- c – Vector defining the direction to project along.
Returns: Oblique projection of a onto b along c.
-
vector_plane_projection
(v, n)[source]¶ Projection of a vector onto a plane with normal n.
Parameters: - v – Vector to project onto the plane.
- n – Normal of the plane.
Returns: Vector projected onto the plane.