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: all(abs(e) < 10^-4 for e in (T - diagonal_matrix(RDF, [-13.5698, -0.8508, 7.7664, 11.6<br />

... [ 5, 1, 3 , 7],<br />

... [-3, 5, 7, -8]])<br />

sage: Q, T = A.schur()<br />

sage: Q.round(4)<br />

[-0.3027 -0.751 0.576 -0.1121]<br />

[ 0.139 -0.3892 -0.2648 0.8713]<br />

[ 0.4361 0.359 0.7599 0.3217]<br />

[ -0.836 0.3945 0.1438 0.3533]<br />

sage: T = T.zero_at(10^-12)<br />

True<br />

sage: (Q*Q.transpose()).zero_at(1.0e-12)<br />

[1.0 0.0 0.0 0.0]<br />

[0.0 1.0 0.0 0.0]<br />

[0.0 0.0 1.0 0.0]<br />

[0.0 0.0 0.0 1.0]<br />

sage: (Q*T*Q.transpose()-A).zero_at(1.0e-11)<br />

[0.0 0.0 0.0 0.0]<br />

[0.0 0.0 0.0 0.0]<br />

[0.0 0.0 0.0 0.0]<br />

[0.0 0.0 0.0 0.0]<br />

The results are cached, both as a real factorization <strong>and</strong> also as a complex factorization. This means the<br />

returned matrices are immutable.<br />

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

sage: Qr, Tr = A.schur(base_ring=RDF)<br />

sage: Qc, Tc = A.schur(base_ring=CDF)<br />

sage: all([M.is_immutable() for M in [Qr, Tr, Qc, Tc]])<br />

True<br />

sage: Tr.round(6) != Tc.round(6)<br />

True<br />

TESTS:<br />

The Schur factorization is only defined for square matrices.<br />

sage: A = matrix(RDF, 4, 5, range(20))<br />

sage: A.schur()<br />

Traceback (most recent call last):<br />

...<br />

ValueError: Schur decomposition requires a square matrix, not a 4 x 5 matrix<br />

A base ring request is checked.<br />

sage: A = matrix(RDF, 3, range(9))<br />

sage: A.schur(base_ring=QQ)<br />

Traceback (most recent call last):<br />

...<br />

ValueError: base ring <strong>of</strong> Schur decomposition matrices must be RDF or CDF, not Rational Field<br />

AUTHOR:<br />

•Rob Beezer (2011-03-31)<br />

singular_values(eps=None)<br />

Returns a sorted list <strong>of</strong> the singular values <strong>of</strong> the matrix.<br />

INPUT:<br />

386 Chapter 19. Dense matrices using a NumPy backend.

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

Saved successfully!

Ooh no, something went wrong!