### Navigation

- index
- modules |
- next |
- previous |
- Matrices and Spaces of Matrices »

# Abstract base class for matrices

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.

  EXAMPLES:

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

`sage.matrix.matrix.``is_Matrix`(x)

  EXAMPLES:

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

### Navigation

- index
- modules |
- next |
- previous |
- Matrices and Spaces of Matrices »