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.

CHAPTER<br />

FIVE<br />

BASE CLASS FOR MATRICES, PART 0<br />

Base class for matrices, part 0<br />

Note: For design documentation see matrix/docs.py.<br />

EXAMPLES:<br />

sage: matrix(2,[1,2,3,4])<br />

[1 2]<br />

[3 4]<br />

class sage.matrix.matrix0.Matrix<br />

Bases: sage.structure.element.Matrix<br />

A generic matrix.<br />

The Matrix class is the base class for all matrix classes. To create a Matrix, first create a MatrixSpace,<br />

then coerce a list <strong>of</strong> elements into the MatrixSpace. See the documentation <strong>of</strong> MatrixSpace for more<br />

details.<br />

EXAMPLES:<br />

We illustrate matrices <strong>and</strong> matrix spaces. Note that no actual matrix that you make should have class Matrix;<br />

the class should always be derived from Matrix.<br />

sage: M = MatrixSpace(CDF,2,3); M<br />

Full MatrixSpace <strong>of</strong> 2 by 3 dense matrices over Complex Double Field<br />

sage: a = M([1,2,3, 4,5,6]); a<br />

[1.0 2.0 3.0]<br />

[4.0 5.0 6.0]<br />

sage: type(a)<br />

<br />

sage: parent(a)<br />

Full MatrixSpace <strong>of</strong> 2 by 3 dense matrices over Complex Double Field<br />

sage: matrix(CDF, 2,3, [1,2,3, 4,5,6])<br />

[1.0 2.0 3.0]<br />

[4.0 5.0 6.0]<br />

sage: Mat(CDF,2,3)(range(1,7))<br />

[1.0 2.0 3.0]<br />

[4.0 5.0 6.0]<br />

sage: Q. = QuaternionAlgebra(QQ, -1,-1)<br />

sage: matrix(Q,2,1,[1,2])<br />

69

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

Saved successfully!

Ooh no, something went wrong!