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: B.is_hermitian(algorithm=’naive’, tol=1.0e-17)<br />

False<br />

sage: B.is_hermitian(algorithm=’naive’, tol=1.0e-15)<br />

True<br />

# r<strong>and</strong>om<br />

A square, empty matrix is trivially Hermitian.<br />

sage: A = matrix(RDF, 0, 0)<br />

sage: A.is_hermitian()<br />

True<br />

Rectangular matrices are never Hermitian, no matter which algorithm is requested.<br />

sage: A = matrix(CDF, 3, 4)<br />

sage: A.is_hermitian()<br />

False<br />

TESTS:<br />

The tolerance must be strictly positive.<br />

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

sage: A.is_hermitian(tol = -3.1)<br />

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

...<br />

ValueError: tolerance must be positive, not -3.1<br />

The algorithm keyword gets checked.<br />

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

sage: A.is_hermitian(algorithm=’junk’)<br />

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

...<br />

ValueError: algorithm must be ’naive’ or ’orthonormal’, not junk<br />

AUTHOR:<br />

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

is_normal(tol=1e-12, algorithm=’orthonormal’)<br />

Returns True if the matrix commutes with its conjugate-transpose.<br />

INPUT:<br />

•tol - default: 1e-12 - the largest value <strong>of</strong> the absolute value <strong>of</strong> the difference between two matrix<br />

entries for which they will still be considered equal.<br />

•algorithm - default: ‘orthonormal’ - set to ‘orthonormal’ for a stable procedure <strong>and</strong> set to ‘naive’<br />

for a fast procedure.<br />

OUTPUT:<br />

True if the matrix is square <strong>and</strong> commutes with its conjugate-transpose, <strong>and</strong> False otherwise.<br />

Normal matrices are precisely those that can be diagonalized by a unitary matrix.<br />

The tolerance parameter is used to allow for numerical values to be equal if there is a slight difference due<br />

to round-<strong>of</strong>f <strong>and</strong> other imprecisions.<br />

The result is cached, on a per-tolerance <strong>and</strong> per-algorithm basis.<br />

ALGORITHMS:<br />

369

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

Saved successfully!

Ooh no, something went wrong!