Skip to main content

Module decompositions

Module decompositions 

Source
Expand description

Named results of matrix decompositions (Qr, Lu, HermiteNormalForm, …) shared by Matrix, ZMatrix and QMatrix. Named results of matrix decompositions and normal forms.

Every factorisation here used to come back as a tuple of two or three matrices — (Q, R), (P, D), (H, U), (S, U, V) — where nothing but memory said which position was which, and a transposition compiled silently. These structs name each factor and document the identity it satisfies, at zero runtime cost. See CONTRIBUTING.md, “Tuples versus structs”.

The structs are generic over the matrix type so that the symbolic Matrix and the exact ZMatrix / QMatrix share one vocabulary: Qr<Matrix>, HermiteNormalForm<ZMatrix>, ….

§Examples

use symplex::prelude::*;

let ctx = Context::new();
let a = matrix![ctx, [4, 2], [2, 3]];
let ldl = a.ldl().unwrap();
assert_eq!((&(&ldl.l * &ldl.d) * &ldl.l.transpose()).eval(), a);

let Qr { q, r } = matrix![ctx, [1, 1], [0, 1]].qr().unwrap();
assert_eq!((&q * &r).simplify(), matrix![ctx, [1, 1], [0, 1]]);

Structs§

Diagonalization
Eigendecomposition A = P·D·P⁻¹: the columns of P are eigenvectors, D is diagonal with the eigenvalues in the same order.
HermiteNormalForm
Row-style Hermite normal form H = U·A with U unimodular (det U = ±1).
Hessenberg
Upper Hessenberg form by similarity: H = P⁻¹·A·P (equivalently A·P = P·H) with h_ij = 0 for i > j + 1.
JordanForm
Jordan normal form A = P·J·P⁻¹: J is block diagonal with Jordan blocks J_k(λ) (eigenvalue on the diagonal, ones on the superdiagonal), P holds the (generalized) eigenvectors.
Ldl
LDLᵀ decomposition A = L·D·Lᵀ of a symmetric matrix: L unit lower triangular, D diagonal.
LllReduction
LLL reduction of the lattice basis formed by the rows of A: reduced = transform·A with transform unimodular (det = ±1), so both span the same lattice.
Lu
LU decomposition with partial pivoting P·A = L·U: L unit lower triangular, U upper triangular, and perm the row permutation — row i of P·A is row perm[i] of A.
Qr
QR decomposition A = Q·R: Q has orthonormal columns, R is upper triangular.
RankDecomposition
Full-rank factorisation A = C·F with r = rank A: C (m × r) is made of the pivot columns of A, F (r × n) of the nonzero rows of rref(A).
SmithNormalForm
Smith normal form S = U·A·V with U, V unimodular (det U = det V = ±1) and S = diag(d₁, …, dᵣ, 0, …), dᵢ | dᵢ₊₁.