08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Matrices</strong> <strong>and</strong> <strong>Spaces</strong> <strong>of</strong> <strong>Matrices</strong>, Release 6.1.1<br />

We illustrate each option:<br />

sage: S = A.saturation(p=2)<br />

sage: S = A.saturation(pro<strong>of</strong>=False)<br />

sage: S = A.saturation(max_dets=2)<br />

smith_form()<br />

Returns matrices S, U, <strong>and</strong> V such that S = U*self*V, <strong>and</strong> S is in Smith normal form. Thus S is diagonal<br />

with diagonal entries the ordered elementary divisors <strong>of</strong> S.<br />

Warning: The elementary_divisors function, which returns the diagonal entries <strong>of</strong> S, is VASTLY<br />

faster than this function.<br />

The elementary divisors are the invariants <strong>of</strong> the finite abelian group that is the cokernel <strong>of</strong> this matrix.<br />

They are ordered in reverse by divisibility.<br />

EXAMPLES:<br />

sage: A = MatrixSpace(IntegerRing(), 3)(range(9))<br />

sage: D, U, V = A.smith_form()<br />

sage: D<br />

[1 0 0]<br />

[0 3 0]<br />

[0 0 0]<br />

sage: U<br />

[ 0 1 0]<br />

[ 0 -1 1]<br />

[-1 2 -1]<br />

sage: V<br />

[-1 4 1]<br />

[ 1 -3 -2]<br />

[ 0 0 1]<br />

sage: U*A*V<br />

[1 0 0]<br />

[0 3 0]<br />

[0 0 0]<br />

It also makes sense for nonsquare matrices:<br />

sage: A = Matrix(ZZ,3,2,range(6))<br />

sage: D, U, V = A.smith_form()<br />

sage: D<br />

[1 0]<br />

[0 2]<br />

[0 0]<br />

sage: U<br />

[ 0 1 0]<br />

[ 0 -1 1]<br />

[-1 2 -1]<br />

sage: V<br />

[-1 3]<br />

[ 1 -2]<br />

sage: U * A * V<br />

[1 0]<br />

[0 2]<br />

[0 0]<br />

Empty matrices are h<strong>and</strong>led sensibly (see trac #3068):<br />

334 Chapter 17. Dense matrices over the integer ring

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!