Abstract base class for matrices

For design documentation see matrix/docs.py.

class sage.matrix.matrix.Matrix

Bases: sage.matrix.matrix2.Matrix

The initialization routine of the Matrix base class ensures that it sets the attributes self._parent, self._base_ring, self._nrows, self._ncols. It sets the latter ones by accessing the relevant information on parent, which is often slower than what a more specific subclass can do.

Subclasses of Matrix can safely skip calling Matrix.__init__ provided they take care of initializing these attributes themselves.

The private attributes self._is_immutable and self._cache are implicitly initialized to valid values upon memory allocation.


sage: import sage.matrix.matrix0
sage: A = sage.matrix.matrix0.Matrix(MatrixSpace(QQ,2))
sage: type(A)
<type 'sage.matrix.matrix0.Matrix'>


sage: from sage.matrix.matrix import is_Matrix
sage: is_Matrix(0)
sage: is_Matrix(matrix([[1,2],[3,4]]))

Previous topic

Miscellaneous matrix functions

Next topic

Base class for matrices, part 0

This Page