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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER<br />

FOUR<br />

ABSTRACT BASE CLASS FOR<br />

MATRICES<br />

Abstract base class for matrices<br />

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

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

Bases: sage.matrix.matrix2.Matrix<br />

The initialization routine <strong>of</strong> the Matrix base class ensures that it sets the attributes self._parent, self._base_ring,<br />

self._nrows, self._ncols. It sets the latter ones by accessing the relevant information on parent, which is <strong>of</strong>ten<br />

slower than what a more specific subclass can do.<br />

Subclasses <strong>of</strong> Matrix can safely skip calling Matrix.__init__ provided they take care <strong>of</strong> initializing these attributes<br />

themselves.<br />

The private attributes self._is_immutable <strong>and</strong> self._cache are implicitly initialized to valid values upon memory<br />

allocation.<br />

EXAMPLES:<br />

sage: import sage.matrix.matrix0<br />

sage: A = sage.matrix.matrix0.Matrix(MatrixSpace(QQ,2))<br />

sage: type(A)<br />

<br />

sage.matrix.matrix.is_Matrix(x)<br />

EXAMPLES:<br />

sage: from sage.matrix.matrix import is_Matrix<br />

sage: is_Matrix(0)<br />

False<br />

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

True<br />

67

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

Saved successfully!

Ooh no, something went wrong!