7.1.1 matrix.matrix_space - Space of matrices over a ring.

The module matrix.matrix_space defines the following methods:

MatrixSpace( base_ring, nrows, [ncols=False], [sparse=None])

Create with the command

MatrixSpace(base_ring , nrows [, ncols] [, sparse])

The default value of the optional argument sparse is False. The default value of the optional argument ncols is nrows.

INPUT:
     base_ring -- a ring
     nrows -- int, the number of rows
     ncols -- (default nrows) int, the number of columns 
     sparse -- (default false) whether or not matrices are given
               a sparse representation
OUTPUT:
    The space of all nrows x ncols matrices over base_ring.

sage: MS = MatrixSpace(RationalField(),2)
sage: MS.base_ring()
Rational Field
sage: MS.dimension()
4
sage: MS.dims()
(2, 2)
sage: B = MS.basis()
sage: B
[[1 0]
[0 0], [0 1]
[0 0], [0 0]
[1 0], [0 0]
[0 1]]
sage: B[0]
[1 0]
[0 0]
sage: B[1]
[0 1]
[0 0]
sage: B[2]
[0 0]
[1 0]
sage: B[3]
[0 0]
[0 1]
sage: A = MS.matrix([1,2,3,4])
sage: A
[1 2]
[3 4]
sage: MS2 = MatrixSpace(RationalField(),2,3)
sage: B = MS2.matrix([1,2,3,4,5,6])
sage: A*B
[ 9 12 15]
[19 26 33]

The module matrix.matrix_space defines the following classes:

class MatrixSpace_domain
The space of all nrows x ncols matrices over base_ring

class MatrixSpace_field
The space of all nrows x ncols matrices over base_field

class MatrixSpace_generic
The space of all nrows x ncols matrices over base_ring.

class MatrixSpace_pid
The space of all nrows x ncols matrices over base_ring



Subsections
See About this document... for information on suggesting changes.