|
D.10.2.9 smith
Procedure from library control.lib (see control_lib).
- Usage:
- smith(M); M a module/matrix
- Purpose:
- computes the Smith normal form of a matrix
- Return:
- a list of length 4 with the following entries:
[1]: the Smith normal form S of M,
[2]: the rank of M,
[3]: a unimodular matrix U,
[4]: a unimodular matrix V,
such that U*M*V=S. An warning is returned when no Smith form exists.
- Note:
- The Smith form only exists over PIDs (principal ideal domains). Use global ordering for computations!
Example:
| LIB "control.lib";
option(redSB);
option(redTail);
ring r = 0,x,dp;
module M = [x2,x,3x3-4], [2x2-1,4x,5x2], [2x5,3x,4x];
print(M);
==> x2, 2x2-1,2x5,
==> x, 4x, 3x,
==> 3x3-4,5x2, 4x
list P = smith(M);
print(P[1]);
==> 1,0,0,
==> 0,1,0,
==> 0,0,x9-5/12x8-25/12x6+5/8x5+1/24x4+x3-1/6x2-1/2x
matrix N = matrix(M);
matrix B = P[3]*N*P[4];
print(B);
==> 1,0,0,
==> 0,1,0,
==> 0,0,x9-5/12x8-25/12x6+5/8x5+1/24x4+x3-1/6x2-1/2x
|
|