Skip to main content

column_hermite_normal_form

Function column_hermite_normal_form 

Source
pub fn column_hermite_normal_form(m: &Matrix) -> Result<Matrix, SymplexError>
Expand description

Column-style Hermite normal form H = A·V (column operations), the convention of SymPy’s hermite_normal_form and of Cohen’s Algorithm 2.4.5.

H has the same shape as A and there is a unimodular V with H = A·V. Normalisation:

  • zero columns come first, followed by the nonzero columns;
  • the pivot of a nonzero column is its lowest nonzero entry, and the pivot rows strictly increase from left to right (so a square nonsingular A gives an upper-triangular H);
  • pivots are positive;
  • in a pivot’s row, every entry to the right of the pivot lies in [0, pivot).

SymPy drops the leading zero columns; here they are kept so that H = A·V holds with V square.

Relation to the row form: reverse the rows of A, take hermite_normal_form of the transpose, transpose back, and reverse both rows and columns. (Transposing alone would give a lower triangular form with pivots at the top of each column.)

§Errors

SymplexError::InvalidArgument if any entry is not an integer literal.

§Examples

use symplex::prelude::*;
use symplex::normalforms::column_hermite_normal_form;

let ctx = Context::new();
// SymPy: hermite_normal_form(Matrix([[12, 6, 4], [3, 9, 6], [2, 16, 14]]))
let a = matrix![ctx, [12, 6, 4], [3, 9, 6], [2, 16, 14]];
let h = column_hermite_normal_form(&a).unwrap();
assert_eq!(h, matrix![ctx, [10, 0, 2], [0, 15, 3], [0, 0, 2]]);