1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-26 02:20:30 +01:00

add gens_idcs to SymplecticMappingClass

This commit is contained in:
Marek Kaluba 2021-07-07 10:33:34 +02:00
parent 79a4450ef9
commit 3629b07626
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -105,6 +105,7 @@ struct SymplecticMappingClass{N,T} <: GSymbol
inv::Bool inv::Bool
images::NTuple{N,T} images::NTuple{N,T}
invimages::NTuple{N,T} invimages::NTuple{N,T}
gens_idcs::Dict{Int, Int}
end end
function SymplecticMappingClass( function SymplecticMappingClass(
@ -161,7 +162,9 @@ function SymplecticMappingClass(
img, invim = inverse ? (invim, img) : (img, invim) img, invim = inverse ? (invim, img) : (img, invim)
res = SymplecticMappingClass(id, UInt(i), UInt(j), minus, inverse, img, invim) gens_idcs = Dict(alphabet(Σ)[Σ.gens[i]] => i for i in 1:ngens(Σ))
res = SymplecticMappingClass(id, UInt(i), UInt(j), minus, inverse, img, invim, gens_idcs)
return res return res
end end
@ -177,7 +180,7 @@ function Base.show(io::IO, smc::SymplecticMappingClass)
end end
function Base.inv(m::SymplecticMappingClass) function Base.inv(m::SymplecticMappingClass)
return SymplecticMappingClass(m.id, m.i, m.j, m.minus, !m.inv, m.invimages, m.images) return SymplecticMappingClass(m.id, m.i, m.j, m.minus, !m.inv, m.invimages, m.images, m.gens_idcs)
end end
function evaluate!( function evaluate!(
@ -186,23 +189,17 @@ function evaluate!(
A::Alphabet, A::Alphabet,
tmp = one(first(t)), tmp = one(first(t)),
) where {N,T} ) where {N,T}
img = smc.inv ? smc.invimages : smc.images img = smc.images
# need a map from generators to letters of the alphabet!
# TODO: move to SymplecticMappingClass
gens_idcs = let G = parent(first(t))
Dict(A[G.gens[i]] => i for i in 1:ngens(G))
end
for elt in t for elt in t
copyto!(tmp, elt) copyto!(tmp, elt)
resize!(word(elt), 0) resize!(word(elt), 0)
for idx in word(tmp) for idx in word(tmp)
# @show idx # @show idx
k = if haskey(gens_idcs, idx) k = if haskey(smc.gens_idcs, idx)
img[gens_idcs[idx]] img[smc.gens_idcs[idx]]
else else
inv(img[gens_idcs[inv(A, idx)]]) inv(img[smc.gens_idcs[inv(A, idx)]])
end end
append!(word(elt), word(k)) append!(word(elt), word(k))
end end