### Navigation

- index
- modules |
- next |
Sage Reference Manual »
- Matrices and Spaces of Matrices »

# Matrices and Spaces of Matrices

Sage provides native support for working with matrices over any commutative or noncommutative ring. The parent object for a matrix is a matrix space `MatrixSpace(R, n, m)` of all \(n\times m\) matrices over a ring \(R\).

To create a matrix, either use the `matrix(...)` function or create a matrix space using the `MatrixSpace` command and coerce an object into it.

Matrices also act on row vectors, which you create using the `vector(...)` command or by making a `VectorSpace` and coercing lists into it. The natural action of matrices on row vectors is from the right. Sage currently does not have a column vector class (on which matrices would act from the left), but this is planned.

In addition to native Sage matrices, Sage also includes the following additional ways to compute with matrices:

- Several math software systems included with Sage have their own native matrix support, which can be used from Sage. E.g., PARI, GAP, Maxima, and Singular all have a notion of matrices.
- The GSL C-library is included with Sage, and can be used via Cython.
- The `scipy` module provides support for sparse numerical linear algebra, among many other things.
- The `numpy` module, which you load by typing `import numpy` is included standard with Sage. It contains a very sophisticated and well developed array class, plus optimized support for numerical linear algebra. Sage’s matrices over RDF and CDF (native floating-point real and complex numbers) use numpy.

Finally, this module contains some data-structures for matrix-like objects like operation tables (e.g. the multiplication table of a group).

- Matrix Spaces
- Matrix Constructor
- Matrices over an arbitrary ring
  - Indexing
- Abstract base class for matrices
- Base class for matrices, part 0
- Base class for matrices, part 1
- Base class for matrices, part 2
- Generic Asymptotically Fast Strassen Algorithms
- Minimal Polynomials of Linear Recurrence Sequences
- Base class for dense matrices
- Base class for sparse matrices
- Dense Matrices over a general ring
- Sparse Matrices over a general ring
- Dense matrices over \(\ZZ/n\ZZ\) for \(n\) small
- Sparse matrices over \(\ZZ/n\ZZ\) for \(n\) small
- Symbolic matrices
- Dense matrices over the integer ring
- Dense matrices over the rational field
- Dense matrices using a NumPy backend.
- Dense matrices over the Real Double Field using NumPy
- Dense matrices over the Complex Double Field using NumPy
- Dense matrices over multivariate polynomials over fields
- Operation Tables
- Benchmarks for matrices

# Indices and Tables

- Index
- Module Index
- Search Page

### Navigation

- index
- modules |
- next |
Sage Reference Manual »
- Matrices and Spaces of Matrices »