Expand description
Integer matrix normal forms: Hermite, Smith, unimodular transforms, integer kernels. Integer matrix normal forms: Hermite normal form, Smith normal form, unimodular transforms and integer kernels.
Everything here is exact over BigInt. Inputs are Matrix values
whose entries must be integer literals (a fraction, a symbol or an
unevaluated constant expression gives
SymplexError::InvalidArgument); results are returned as integer
matrices in the same Context.
§Conventions
hermite_normal_formis row-style:H = U·AwithUunimodular (det U = ±1).His in row echelon form with positive pivots, every entry above a pivot reduced into[0, pivot), zero rows at the bottom. This form is unique, so it is idempotent and invariant under left-multiplication by any unimodular matrix.column_hermite_normal_formis column-style:H = A·V, the convention used by SymPy’shermite_normal_form(Cohen, A Course in Computational Algebraic Number Theory, Algorithm 2.4.5): each nonzero column’s pivot is its lowest nonzero entry, pivots move strictly downwards from left to right, pivots are positive, entries to the right of a pivot in its row lie in[0, pivot), zero columns come first. For a square nonsingular matrix this is upper triangular.smith_normal_formgivesS = U·A·V = diag(d₁, …, dᵣ, 0, …)withdᵢ > 0anddᵢ | dᵢ₊₁.
§Examples
use symplex::prelude::*;
use symplex::normalforms::{hermite_normal_form_with_transform, smith_normal_form};
let ctx = Context::new();
let a = matrix![ctx, [2, 4, 4], [-6, 6, 12], [10, -4, -16]];
let (h, u) = hermite_normal_form_with_transform(&a).unwrap();
assert_eq!(h, matrix![ctx, [2, 4, 4], [0, 6, 0], [0, 0, 12]]);
assert_eq!((&u * &a).eval(), h);
assert_eq!(smith_normal_form(&a).unwrap(), matrix![ctx, [2, 0, 0], [0, 6, 0], [0, 0, 12]]);Functions§
- column_
hermite_ normal_ form - Column-style Hermite normal form
H = A·V(column operations), the convention of SymPy’shermite_normal_formand of Cohen’s Algorithm 2.4.5. - hermite_
normal_ form - Row-style Hermite normal form
Hof an integer matrixA. - hermite_
normal_ form_ with_ transform - Row-style Hermite normal form together with its transform:
(H, U)withH = U·Aanddet U = ±1. Seehermite_normal_formfor the normalisation ofH. - integer_
nullspace - A ℤ-basis of the integer kernel
{x ∈ ℤⁿ : A·x = 0}of anm×ninteger matrix, asn×1column vectors. - is_
unimodular - Is
Aa square integer matrix withdet A = ±1(invertible over ℤ)? - lattice_
determinant - Determinant (index) of the lattice spanned by the columns of
A. - smith_
normal_ form - Smith normal form
S = diag(d₁, …, dᵣ, 0, …, 0)of an integer matrix, withdᵢ > 0anddᵢ | dᵢ₊₁. - smith_
normal_ form_ with_ transforms - Smith normal form with transforms:
(S, U, V)such thatS = U·A·V,det U = ±1,det V = ±1. Seesmith_normal_formfor the form ofS.UandVare not unique; the returned pair is the one produced by the elimination.