From e9a4ac4d54126d82046aa4baeffe765b01980c11 Mon Sep 17 00:00:00 2001 From: James Nohilly <184946269+jamesnohilly@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:03:06 +0200 Subject: [PATCH] Add syllable functions to pcgroup Moved from the mjrodgers-OW_GModules branch. --- src/Groups/pcgroup.jl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Groups/pcgroup.jl b/src/Groups/pcgroup.jl index 923170798e44..879e1b6d213d 100644 --- a/src/Groups/pcgroup.jl +++ b/src/Groups/pcgroup.jl @@ -365,3 +365,28 @@ function pc_group(c::GAP_Collector) end end +function Oscar.syllables(g::Union{PcGroupElem, SubPcGroupElem}) + l = GAPWrap.ExtRepOfObj(GapObj(g)) + @assert iseven(length(l)) + return Pair{Int, ZZRingElem}[l[i-1] => l[i] for i = 2:2:length(l)] +end + +# Convert syllables in canonical form into exponent vector +#Thomas +function exponent_vector(sylls::Vector{Pair{Int64, ZZRingElem}}, n) + res = zeros(ZZRingElem, n) + for pair in sylls + @assert res[pair.first] == 0 #just to make sure + res[pair.first] = pair.second + end + return res +end + +# Convert syllables in canonical form into group element +#Thomas +function (G::PcGroup)(sylls::Vector{Pair{Int64, ZZRingElem}}) + e = exponent_vector(sylls, ngens(G)) + pcgs = Oscar.GAPWrap.FamilyPcgs(GapObj(G)) + x = Oscar.GAPWrap.PcElementByExponentsNC(pcgs, GapObj(e, true)) + return Oscar.group_element(G, x) +end \ No newline at end of file