Matrix algebras

A matrix algebra (or matrix ring) represents the collection of all square matrices of a fixed number of rows, referred to as the degree of the matrix algebra, over a fixed base ring. Matrix algebras are parent objects; their elements are the corresponding matrices.

Matrix algebras are noncommutative rings. They support the usual ring operations, such as addition and multiplication, and can be used in constructions accepting noncommutative base rings.

Although elements of matrix algebras mostly behave like matrices, their parent object is a matrix algebra rather than a matrix space. Therefore, some functionality available for matrices in matrix spaces is not available for matrix algebra elements, in particular functions which do not preserve square matrices (e.g. kernel).

Creating matrix algebras

AbstractAlgebra.matrix_ringMethod
matrix_ring(R::NCRing, n::Int)

Return the matrix algebra (or matrix ring) of degree $n$ over the base ring $R$.

The returned parent object represents the ring of all $n \times n$ matrices over $R$.

Examples

julia> R, t = polynomial_ring(QQ, :t)
(Univariate polynomial ring in t over rationals, t)

julia> S = matrix_ring(R, 3)
Matrix ring of degree 3
  over univariate polynomial ring in t over rationals
source

Properties of matrix algebras

AbstractAlgebra.degreeMethod
degree(a::MatRing)

Return the degree $n$ of the given matrix algebra.

The degree is the number of rows of the square matrices belonging to a.

Examples

julia> R, t = polynomial_ring(QQ, :t)
(Univariate polynomial ring in t over rationals, t)

julia> S = matrix_ring(R, 3)
Matrix ring of degree 3
  over univariate polynomial ring in t over rationals

julia> degree(S)
3
source

The base ring can be queried using base_ring.

Creating elements of a matrix algebra

Calling a matrix algebra

AbstractAlgebra.Generic.MatRingType
(a::MatRing{T})() where {T <: NCRingElement}
(a::MatRing{T})(b::S) where {S <: NCRingElement, T <: NCRingElement}
(a::MatRing{T})(b::T) where {S <: NCRingElement, T <: MatRingElem{S}}
(a::MatRing{T})(b::MatRingElem{T}) where {T <: NCRingElement}
(a::MatRing{T})(b::MatrixElem{S}) where {S <: NCRingElement, T <: NCRingElement}
(a::MatRing{T})(b::Matrix{S}) where {S <: NCRingElement, T <: NCRingElement}
(a::MatRing{T})(b::Vector{S}) where {S <: NCRingElement, T <: NCRingElement}

Construct an element of the matrix algebra a.

The call a() returns the zero matrix in a.

If b is a ring element coercible into the base ring of a, then a(b) returns the scalar matrix in a whose diagonal entries are b.

If b is a matrix algebra element whose parent is a, then a(b) returns b unchanged.

If b is a matrix whose dimensions and base ring agree with those of a, then a(b) returns the corresponding element of a. If necessary, a new matrix with the appropriate implementation type is constructed.

If b is a Julia vector or matrix, then a(b) constructs an element of a whose entries are obtained by coercing the entries of b into the base ring of a. The dimensions of the Julia object must be compatible with the degree of the matrix algebra.

Examples

julia> R, = residue_ring(ZZ, 7);

julia> A = matrix_ring(R, 3);

julia> A()
[0   0   0]
[0   0   0]
[0   0   0]

julia> A(R(3))
[3   0   0]
[0   3   0]
[0   0   3]

julia> M = A([R(1) R(2) R(3); R(4) R(5) R(6); R(0) R(1) R(2)])
[1   2   3]
[4   5   6]
[0   1   2]

julia> A(M) === M
true

julia> A([R(1), R(2), R(3), R(4), R(5), R(6), R(0), R(1), R(2)])
[1   2   3]
[4   5   6]
[0   1   2]

julia> S = matrix_space(R, 3, 3);

julia> N = S([R(1) R(0) R(0); R(0) R(2) R(0); R(0) R(0) R(3)]);

julia> A(N)
[1   0   0]
[0   2   0]
[0   0   3]
source

Special elements

As for other rings, the additive and multiplicative identities of a matrix algebra can be constructed using zero and one.

julia> S = matrix_ring(ZZ, 2)
Matrix ring of degree 2
  over integers

julia> zero(S)
[0   0]
[0   0]

julia> one(S)
[1   0]
[0   1]

Properties of matrix algebra elements

Base.parentMethod
parent(a::MatRingElem{T}) where T <: NCRingElement

Return the matrix algebra containing a.

This is the matrix algebra over the base ring of a whose degree is the number of rows (equivalently columns) of a.

Examples

julia> S = matrix_ring(ZZ, 2)
Matrix ring of degree 2
  over integers

julia> A = S([1 2; 3 4])
[1   2]
[3   4]

julia> parent(A) == S
true
source
AbstractAlgebra.degreeMethod
degree(a::MatRingElem{T}) where T <: NCRingElement

Return the degree $n$ of the parent matrix algebra of a.

Examples

julia> R, t = polynomial_ring(QQ, :t)
(Univariate polynomial ring in t over rationals, t)

julia> S = matrix_ring(R, 3)
Matrix ring of degree 3
  over univariate polynomial ring in t over rationals

julia> A = S([t + 1 t R(1); t^2 t t; R(-2) t + 2 t^2 + t + 1])
[t + 1       t             1]
[  t^2       t             t]
[   -2   t + 2   t^2 + t + 1]

julia> degree(A)
3
source