Matrix spaces
A matrix space represents the collection of all matrices with a fixed number of rows and columns over a fixed base ring. Matrix spaces are parent objects; their elements are the corresponding matrices.
Creating matrix spaces
AbstractAlgebra.matrix_space — Method
matrix_space(R::NCRing, r::Int, c::Int)Return the space of $r \times c$ matrices over the ring R.
The returned object is the parent object for matrices with r rows and c columns whose entries belong to R.
Examples
julia> R, t = polynomial_ring(QQ, :t)
(Univariate polynomial ring in t over rationals, t)
julia> S = matrix_space(R, 2, 3)
Matrix space of 2 rows and 3 columns
over univariate polynomial ring in t over rationalsProperties of matrix spaces
AbstractAlgebra.number_of_rows — Method
number_of_rows(s::MatSpace)Return the number of rows of the matrices in the matrix space s.
Examples
julia> S = matrix_space(QQ, 2, 3)
Matrix space of 2 rows and 3 columns
over rationals
julia> number_of_rows(S)
2AbstractAlgebra.number_of_columns — Method
number_of_columns(s::MatSpace)Return the number of columns of the matrices in the matrix space s.
Examples
julia> S = matrix_space(QQ, 2, 3)
Matrix space of 2 rows and 3 columns
over rationals
julia> number_of_columns(S)
3The base ring and the vector space dimension of the matrix space can be queried with base_space and vector_space_dim, respectively.
Creating elements of a matrix space
Calling a matrix space
AbstractAlgebra.MatSpace — Type
(S::MatSpace{T})() where {T <: NCRingElement}
(S::MatSpace)(a::NCRingElement)
(S::MatSpace{T})(a::MatrixElem{T}) where {T <: NCRingElement}
(S::MatSpace{T})(a::AbstractVecOrMat) where {T <: NCRingElement}Construct an element of the matrix space S.
The call S() returns the zero matrix in s.
If a is a ring element coercible into the base ring of S, then S(a) returns the diagonal matrix in S whose diagonal entries are a.
If a is a matrix whose dimensions and base ring agree with those of S, then S(a) returns the corresponding element of S. If necessary, a new matrix with the appropriate implementation type is constructed.
If a is a Julia vector or matrix, then S(a) constructs an element of S whose entries are obtained by coercing the entries of a into the base ring of S. The entries are interpreted in row-major order and must have length nrows(S) * ncols(S).
Examples
julia> R, t = polynomial_ring(QQ, :t)
(Univariate polynomial ring in t over rationals, t)
julia> S = matrix_space(R, 3, 3)
Matrix space of 3 rows and 3 columns
over univariate polynomial ring in t over rationals
julia> S()
[0 0 0]
[0 0 0]
[0 0 0]
julia> S(12)
[12 0 0]
[ 0 12 0]
[ 0 0 12]
julia> S(zero_matrix(R, 3, 3))
[0 0 0]
[0 0 0]
[0 0 0]
julia> S(BigInt[2 3 1; 1 0 4; 0 0 1])
[2 3 1]
[1 0 4]
[0 0 1]Special elements
Recovering the parent object
Base.parent — Method
parent(M::MatElem)Return the matrix space over the base ring of M with the same dimensions as M.
Examples
julia> M = matrix(QQ, [1 2 3; 4 5 6])
[1//1 2//1 3//1]
[4//1 5//1 6//1]
julia> parent(M)
Matrix space of 2 rows and 3 columns
over rationals