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

The naive algorithm simply compares entries <strong>of</strong> the two possible products <strong>of</strong> the matrix with its conjugatetranspose,<br />

with equality controlled by the tolerance parameter.<br />

The orthonormal algorithm first computes a Schur decomposition (via the schur() method) <strong>and</strong> checks<br />

that the result is a diagonal matrix. An orthonormal diagonalization is equivalent to being normal.<br />

So the naive algorithm can finish fairly quickly for a matrix that is not normal, once the products have<br />

been computed. However, the orthonormal algorithm will compute a Schur decomposition before going<br />

through a similar check <strong>of</strong> a matrix entry-by-entry.<br />

EXAMPLES:<br />

First over the complexes. B is Hermitian, hence normal.<br />

sage: A = matrix(CDF, [[ 1 + I, 1 - 6*I, -1 - I],<br />

... [-3 - I, -4*I, -2],<br />

... [-1 + I, -2 - 8*I, 2 + I]])<br />

sage: B = A*A.conjugate_transpose()<br />

sage: B.is_hermitian()<br />

True<br />

sage: B.is_normal(algorithm=’orthonormal’)<br />

True<br />

sage: B.is_normal(algorithm=’naive’)<br />

True<br />

sage: B[0,0] = I<br />

sage: B.is_normal(algorithm=’orthonormal’)<br />

False<br />

sage: B.is_normal(algorithm=’naive’)<br />

False<br />

Now over the reals. Circulant matrices are normal.<br />

sage: G = graphs.CirculantGraph(20, [3, 7])<br />

sage: D = digraphs.Circuit(20)<br />

sage: A = 3*D.adjacency_matrix() - 5*G.adjacency_matrix()<br />

sage: A = A.change_ring(RDF)<br />

sage: A.is_normal()<br />

True<br />

sage: A.is_normal(algorithm = ’naive’)<br />

True<br />

sage: A[19,0] = 4.0<br />

sage: A.is_normal()<br />

False<br />

sage: A.is_normal(algorithm = ’naive’)<br />

False<br />

Skew-Hermitian matrices are normal.<br />

sage: A = matrix(CDF, [[ 1 + I, 1 - 6*I, -1 - I],<br />

... [-3 - I, -4*I, -2],<br />

... [-1 + I, -2 - 8*I, 2 + I]])<br />

sage: B = A - A.conjugate_transpose()<br />

sage: B.is_hermitian()<br />

False<br />

sage: B.is_normal()<br />

True<br />

sage: B.is_normal(algorithm=’naive’)<br />

True<br />

A small matrix that does not fit into any <strong>of</strong> the usual categories <strong>of</strong> normal matrices.<br />

370 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!