rename matrix_repr to simply matrix

This commit is contained in:
Marek Kaluba 2023-03-15 16:51:22 +01:00
parent b7a6f4e952
commit f096a869b8
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
4 changed files with 10 additions and 10 deletions

View File

@ -53,7 +53,7 @@ function Groups._abelianize(
ab = Groups.Homomorphism(Groups._abelianize, source, SlN, check=false) ab = Groups.Homomorphism(Groups._abelianize, source, SlN, check=false)
matrix_spn_map = let S = gens(target) matrix_spn_map = let S = gens(target)
Dict(MatrixGroups.matrix_repr(g) => word(g) for g in union(S, inv.(S))) Dict(MatrixGroups.matrix(g) => word(g) for g in union(S, inv.(S)))
end end
# renumeration: # renumeration:
@ -63,7 +63,7 @@ function Groups._abelianize(
p = [reverse(2:2:N); reverse(1:2:N)] p = [reverse(2:2:N); reverse(1:2:N)]
g = source([i]) g = source([i])
Mg = MatrixGroups.matrix_repr(ab(g))[p, p] Mg = MatrixGroups.matrix(ab(g))[p, p]
return matrix_spn_map[Mg] return matrix_spn_map[Mg]
end end

View File

@ -2,12 +2,12 @@ abstract type MatrixGroup{N,T} <: Groups.AbstractFPGroup end
const MatrixGroupElement{N,T} = Groups.AbstractFPGroupElement{<:MatrixGroup{N,T}} const MatrixGroupElement{N,T} = Groups.AbstractFPGroupElement{<:MatrixGroup{N,T}}
Base.isone(g::MatrixGroupElement{N,T}) where {N,T} = Base.isone(g::MatrixGroupElement{N,T}) where {N,T} =
isone(word(g)) || matrix_repr(g) == LinearAlgebra.I isone(word(g)) || isone(matrix(g))
function Base.:(==)(m1::M1, m2::M2) where {M1<:MatrixGroupElement,M2<:MatrixGroupElement} function Base.:(==)(m1::M1, m2::M2) where {M1<:MatrixGroupElement,M2<:MatrixGroupElement}
parent(m1) === parent(m2) || return false parent(m1) === parent(m2) || return false
word(m1) == word(m2) && return true word(m1) == word(m2) && return true
return matrix_repr(m1) == matrix_repr(m2) return matrix(m1) == matrix(m2)
end end
Base.size(m::MatrixGroupElement{N}) where {N} = (N, N) Base.size(m::MatrixGroupElement{N}) where {N} = (N, N)
@ -19,15 +19,15 @@ Base.parent(sl::MatrixGroupElement) = sl.parent
Groups.alphabet(M::MatrixGroup) = M.alphabet Groups.alphabet(M::MatrixGroup) = M.alphabet
Groups.rewriting(M::MatrixGroup) = alphabet(M) Groups.rewriting(M::MatrixGroup) = alphabet(M)
Base.hash(sl::MatrixGroupElement, h::UInt) = Base.hash(m::MatrixGroupElement, h::UInt) =
hash(matrix_repr(sl), hash(parent(sl), h)) hash(matrix(m), hash(parent(m), h))
function matrix_repr(m::MatrixGroupElement{N,T}) where {N,T} function matrix(m::MatrixGroupElement{N,T}) where {N,T}
if isone(word(m)) if isone(word(m))
return StaticArrays.SMatrix{N,N,T}(LinearAlgebra.I) return StaticArrays.SMatrix{N,N,T}(LinearAlgebra.I)
end end
A = alphabet(parent(m)) A = alphabet(parent(m))
return prod(matrix_repr(A[l]) for l in word(m)) return prod(matrix(A[l]) for l in word(m))
end end
function Base.rand( function Base.rand(

View File

@ -20,7 +20,7 @@ Base.hash(e::ElementaryMatrix, h::UInt) =
Base.inv(e::ElementaryMatrix{N}) where {N} = Base.inv(e::ElementaryMatrix{N}) where {N} =
ElementaryMatrix{N}(e.i, e.j, -e.val) ElementaryMatrix{N}(e.i, e.j, -e.val)
function matrix_repr(e::ElementaryMatrix{N,T}) where {N,T} function matrix(e::ElementaryMatrix{N,T}) where {N,T}
m = StaticArrays.MMatrix{N,N,T}(LinearAlgebra.I) m = StaticArrays.MMatrix{N,N,T}(LinearAlgebra.I)
m[e.i, e.j] = e.val m[e.i, e.j] = e.val
x = StaticArrays.SMatrix{N,N}(m) x = StaticArrays.SMatrix{N,N}(m)

View File

@ -57,7 +57,7 @@ LinearAlgebra.transpose(s::ElementarySymplectic{N}) where {N} =
Base.inv(s::ElementarySymplectic{N}) where {N} = Base.inv(s::ElementarySymplectic{N}) where {N} =
ElementarySymplectic{N}(s.symbol, s.i, s.j, -s.val) ElementarySymplectic{N}(s.symbol, s.i, s.j, -s.val)
function matrix_repr(s::ElementarySymplectic{N,T}) where {N,T} function matrix(s::ElementarySymplectic{N,T}) where {N,T}
@assert iseven(N) @assert iseven(N)
n = div(N, 2) n = div(N, 2)
m = StaticArrays.MMatrix{N,N,T}(LinearAlgebra.I) m = StaticArrays.MMatrix{N,N,T}(LinearAlgebra.I)