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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<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 />

... d = (M*M).determinant()<br />

... assert d.is_square()<br />

echelon_form(algorithm=’default’, pro<strong>of</strong>=None, include_zero_rows=True, transformation=False,<br />

D=None)<br />

Return the echelon form <strong>of</strong> this matrix over the integers, also known as the hermit normal form (HNF).<br />

INPUT:<br />

•algorithm – String. The algorithm to use. Valid options are:<br />

–’default’ – Let <strong>Sage</strong> pick an algorithm (default). Up to 10 rows or columns: pari with flag 0;<br />

Up to 75 rows or columns: pari with flag 1; Larger: use padic algorithm.<br />

–’padic’ - an asymptotically fast p-adic modular algorithm, If your matrix has large coefficients<br />

<strong>and</strong> is small, you may also want to try this.<br />

–’pari’ - use PARI with flag 1<br />

–’pari0’ - use PARI with flag 0<br />

–’pari4’ - use PARI with flag 4 (use heuristic LLL)<br />

–’ntl’ - use NTL (only works for square matrices <strong>of</strong> full rank!)<br />

•pro<strong>of</strong> - (default: True); if pro<strong>of</strong>=False certain determinants are computed using a r<strong>and</strong>omized hybrid<br />

p-adic multimodular strategy until it stabilizes twice (instead <strong>of</strong> up to the Hadamard bound). It is<br />

incredibly unlikely that one would ever get an incorrect result with pro<strong>of</strong>=False.<br />

•include_zero_rows - (default: True) if False, don’t include zero rows<br />

•transformation - if given, also compute transformation matrix; only valid for padic algorithm<br />

•D - (default: None) if given <strong>and</strong> the algorithm is ‘ntl’, then D must be a multiple <strong>of</strong> the determinant<br />

<strong>and</strong> this function will use that fact.<br />

OUTPUT:<br />

The Hermite normal form (=echelon form over Z) <strong>of</strong> self.<br />

EXAMPLES:<br />

sage: A = MatrixSpace(ZZ,2)([1,2,3,4])<br />

sage: A.echelon_form()<br />

[1 0]<br />

[0 2]<br />

sage: A = MatrixSpace(ZZ,5)(range(25))<br />

sage: A.echelon_form()<br />

[ 5 0 -5 -10 -15]<br />

[ 0 1 2 3 4]<br />

[ 0 0 0 0 0]<br />

[ 0 0 0 0 0]<br />

[ 0 0 0 0 0]<br />

Getting a transformation matrix in the nonsquare case:<br />

sage: A = matrix(ZZ,5,3,[1..15])<br />

sage: H, U = A.hermite_form(transformation=True, include_zero_rows=False)<br />

sage: H<br />

[1 2 3]<br />

[0 3 6]<br />

sage: U<br />

[ 0 0 0 4 -3]<br />

[ 0 0 0 13 -10]<br />

321

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

Saved successfully!

Ooh no, something went wrong!