make evaluate[!] a general thing for AutomorphismGroups

This commit is contained in:
Marek Kaluba 2021-06-07 20:23:04 +02:00
parent f74b48b890
commit 2992244a24
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
3 changed files with 16 additions and 16 deletions

View File

@ -18,17 +18,3 @@ function relations(G::AutomorphismGroup{<:FreeGroup})
n = length(KnuthBendix.alphabet(object(G))) ÷ 2
return last(gersten_relations(n, commutative = false))
end
evaluate(f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}}) = evaluate!(domain(f), f)
function evaluate!(
t::NTuple{N,T},
f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}},
tmp = one(first(t)),
) where {T<:FPGroupElement,N}
A = alphabet(f)
for idx in word(f)
t = @inbounds evaluate!(t, A[idx], alphabet(object(parent(f))), tmp)::NTuple{N,T}
end
return t
end

View File

@ -46,7 +46,7 @@ Base.:(==)(t::Transvection, s::Transvection) =
t.id === s.id && t.ij == s.ij && t.inv == s.inv
Base.hash(t::Transvection, h::UInt) = hash(t.id, hash(t.ij, hash(t.inv, h)))
Base.@propagate_inbounds function evaluate!(v::Tuple, t::Transvection, A::Alphabet, tmp=one(first(v)))
Base.@propagate_inbounds function evaluate!(v::NTuple{T, N}, t::Transvection, A::Alphabet, tmp=one(first(v))) where {T, N}
i, j = indices(t)
@assert i length(v) && j length(v)

View File

@ -89,6 +89,20 @@ Base.show(io::IO, A::AutomorphismGroup) = print(io, "automorphism group of ", ob
domain(f::FPGroupElement{<:AutomorphismGroup}) = deepcopy(parent(f).domain)
# tuple(gens(object(parent(f)))...)
evaluate(f::FPGroupElement{<:AutomorphismGroup}) = throw("you need to implement `evaluate(::typeof(f))`")
evaluate(f::FPGroupElement{<:AutomorphismGroup}) = evaluate!(domain(f), f)
function evaluate!(
t::NTuple{N,T},
f::FPGroupElement{<:AutomorphismGroup{<:Group}},
tmp = one(first(t)),
) where {N, T}
A = alphabet(f)
AF = alphabet(object(parent(f)))
for idx in word(f)
t = @inbounds evaluate!(t, A[idx], AF, tmp)::NTuple{N,T}
end
return t
end
evaluate!(t::NTuple{N, T}, s::GSymbol, A, tmp=one(first(t))) where {N, T} = throw("you need to implement `evaluate!(::$(typeof(t)), ::$(typeof(s)), ::Alphabet, tmp=one(first(t)))`")