smith_normal_decomp(m) returns the Smith normal form smf of a
DomainMatrix() over a principal ideal domain with invertible matrices
s and t such that smf == s * m * t; is_smith_normal_form(m) tests
whether a matrix is in Smith normal form. smith_normal_form(),
invariant_factors() and hermite_normal_form() also accept a
DomainMatrix.
Examples
m <- DM(list(list(12, 6, 4), list(3, 9, 6), list(2, 16, 14)), ZZ)
smith_normal_decomp(m)
#> (DomainMatrix([[1, 0, 0], [0, 10, 0], [0, 0, 30]], (3, 3), ZZ), DomainMatrix([[0, 1, -1], [1, -4, 0], [0, -2, 3]], (3, 3), ZZ), DomainMatrix([[1, 1, 10], [0, -1, -2], [0, 1, 3]], (3, 3), ZZ))
is_smith_normal_form(DM(list(list(1, 0), list(0, 2)), ZZ))
#> [1] TRUE