integer-only Smith normal form
ismith(A, U, V)
rectangular matrix of integers
Important: The linalg package has been deprecated. Use the superseding packages, LinearAlgebra and VectorCalculus, instead.
- For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
The function ismith computes the Smith normal form S of an n by m rectangular matrix of integers.
If two n by n matrices have the same Smith normal form, they are equivalent.
The Smith normal form is a diagonal matrix where
rank(A) = number of nonzero rows (columns) of S
sign(S[i,i]) = 1 for 0 < i <= rank(A)
S[i,i] divides S[i+1,i+1] for 0 < i < rank(A)
product(S[i,i],i=1..r) divides det(M) for all minors M of rank 0 < r <= rank(A)
Hence if n = m and rank(A) = n then det⁡A=∏i=1n⁡Si,i.
The Smith normal form is obtained by doing elementary row and column operations. This includes interchanging rows (columns), multiplying through a row (column) by -1, and adding integral multiples of one row (column) to another.
Although the rank and determinant can be easily obtained from S this is not an efficient method for computing these quantities except that this may yield a partial factorization of det⁡A without doing any explicit factorizations.
In the case of three arguments, the second argument U and the third argument V will be assigned the transformation matrices on output, such that smith(A) = U &* A &* V.
The command with(linalg,ismith) allows the use of the abbreviated form of this command.
H ≔ array⁡9,−36,30,−36,192,−180,30,−180,180
A ≔ array⁡13,5,7,17,31,39
B ≔ ismith⁡A,U,V
evalm⁡U &* A &* V−B
Download Help Document