|
D.15.12.49 smithNormalForm
Procedure from library multigrading.lib (see multigrading_lib).
- Usage:
- smithNormalForm(A[,opt]); intmat A
- Purpose:
- Computes the Smith Normal Form of A
- Return:
- if no optional argument is given: intmat, the Smith Normal Form of A,
otherwise: a list of 3 integer matrices P, D Q, such that D == P*A*Q.
Example:
| LIB "multigrading.lib";
intmat A[5][7] =
1,0,1,0,-2,9,-71,
0,-24,248,-32,-96,448,-3496,
0,4,-42,4,-8,30,-260,
0,0,0,18,-90,408,-3168,
0,0,0,-32,224,-1008,7872;
print( smithNormalForm(A) );
==> 1 0 0 0 0 0 0
==> 0 2 2 6 12 0 0
==> 0 0 2 0 0 0 0
==> 0 0 0 8 0 0 0
==> 0 0 0 0 48 0 0
list l = smithNormalForm(A, 5);
l;
==> [1]:
==> 1,0,0,0,0,
==> 0,0,1,0,0,
==> 0,-1,4,-1,0,
==> 0,3,-12,4,-1,
==> 0,-6,24,-8,3
==> [2]:
==> 1,0,0,0,0,0,0,
==> 0,2,2,6,12,0,0,
==> 0,0,2,0,0,0,0,
==> 0,0,0,8,0,0,0,
==> 0,0,0,0,48,0,0
==> [3]:
==> 1,5,45,187,384,8,18591,
==> 0,-52,-461,-1914,-3929,-82,-190555,
==> 0,-5,-53,-218,-445,-10,-23236,
==> 0,0,-28,-109,-215,-7,-16260,
==> 0,0,221,871,1729,53,123084,
==> 0,0,50,197,391,12,27876,
==> 0,0,0,0,0,0,1
l[1]*A*l[3];
==> 1,0,0,0,0,0,0,
==> 0,2,2,6,12,0,0,
==> 0,0,2,0,0,0,0,
==> 0,0,0,8,0,0,0,
==> 0,0,0,0,48,0,0
det(l[1]);
==> 1
det(l[3]);
==> 1
|
|