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

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

sage: U*A == H<br />

True<br />

TESTS: Make sure the zero matrices are h<strong>and</strong>led correctly:<br />

sage: m = matrix(ZZ,3,3,[0]*9)<br />

sage: m.echelon_form()<br />

[0 0 0]<br />

[0 0 0]<br />

[0 0 0]<br />

sage: m = matrix(ZZ,3,1,[0]*3)<br />

sage: m.echelon_form()<br />

[0]<br />

[0]<br />

[0]<br />

sage: m = matrix(ZZ,1,3,[0]*3)<br />

sage: m.echelon_form()<br />

[0 0 0]<br />

The ultimate border case!<br />

sage: m = matrix(ZZ,0,0,[])<br />

sage: m.echelon_form()<br />

[]<br />

Note: If ‘ntl’ is chosen for a non square matrix this function raises a ValueError.<br />

Special cases: 0 or 1 rows:<br />

sage: a = matrix(ZZ, 1,2,[0,-1])<br />

sage: a.hermite_form()<br />

[0 1]<br />

sage: a.pivots()<br />

(1,)<br />

sage: a = matrix(ZZ, 1,2,[0,0])<br />

sage: a.hermite_form()<br />

[0 0]<br />

sage: a.pivots()<br />

()<br />

sage: a = matrix(ZZ,1,3); a<br />

[0 0 0]<br />

sage: a.echelon_form(include_zero_rows=False)<br />

[]<br />

sage: a.echelon_form(include_zero_rows=True)<br />

[0 0 0]<br />

Illustrate using various algorithms.:<br />

sage: matrix(ZZ,3,[1..9]).hermite_form(algorithm=’pari’)<br />

[1 2 3]<br />

327

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

Saved successfully!

Ooh no, something went wrong!