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

EXAMPLES:<br />

sage: matrix(QQ,2,2,range(4)).is_sparse()<br />

False<br />

sage: matrix(QQ,2,2,range(4),sparse=True).is_sparse()<br />

True<br />

is_square()<br />

Return True precisely if this matrix is square, i.e., has the same number <strong>of</strong> rows <strong>and</strong> columns.<br />

EXAMPLES:<br />

sage: matrix(QQ,2,2,range(4)).is_square()<br />

True<br />

sage: matrix(QQ,2,3,range(6)).is_square()<br />

False<br />

is_symmetric()<br />

Returns True if this is a symmetric matrix.<br />

EXAMPLES:<br />

sage: m=Matrix(QQ,2,range(0,4))<br />

sage: m.is_symmetric()<br />

False<br />

sage: m=Matrix(QQ,2,(1,1,1,1,1,1))<br />

sage: m.is_symmetric()<br />

False<br />

sage: m=Matrix(QQ,1,(2,))<br />

sage: m.is_symmetric()<br />

True<br />

is_symmetrizable(return_diag=False, positive=True)<br />

This function takes a square matrix over an ordered integral domain <strong>and</strong> checks if it is symmetrizable. A<br />

matrix B is symmetrizable iff there exists an invertible diagonal matrix D such that DB is symmetric.<br />

Warning: Expects self to be a matrix over an ordered integral domain.<br />

INPUT:<br />

•return_diag – bool(default:False) if True <strong>and</strong> self is symmetrizable the diagonal entries <strong>of</strong> the<br />

matrix D are returned.<br />

•positive – bool(default:True) if True, the condition that D has positive entries is added.<br />

OUTPUT:<br />

•True – if self is symmetrizable <strong>and</strong> return_diag is False<br />

•the diagonal entries <strong>of</strong> a matrix D such that DB is symmetric – iff self is symmetrizable <strong>and</strong><br />

return_diag is True<br />

•False – iff self is not symmetrizable<br />

EXAMPLES:<br />

sage: matrix([[0,6],[3,0]]).is_symmetrizable(positive=False)<br />

True<br />

sage: matrix([[0,6],[3,0]]).is_symmetrizable(positive=True)<br />

78 Chapter 5. Base class for matrices, part 0

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

Saved successfully!

Ooh no, something went wrong!