Skip to content

Commit

Permalink
Add syllable functions to pcgroup
Browse files Browse the repository at this point in the history
Moved from the mjrodgers-OW_GModules branch.
  • Loading branch information
jamesnohilly committed Oct 14, 2024
1 parent da7acb0 commit e9a4ac4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Groups/pcgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Check warning on line 371 in src/Groups/pcgroup.jl

View check run for this annotation

Codecov / codecov/patch

src/Groups/pcgroup.jl#L368-L371

Added lines #L368 - L371 were not covered by tests
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

Check warning on line 382 in src/Groups/pcgroup.jl

View check run for this annotation

Codecov / codecov/patch

src/Groups/pcgroup.jl#L376-L382

Added lines #L376 - L382 were not covered by tests
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)

Check warning on line 391 in src/Groups/pcgroup.jl

View check run for this annotation

Codecov / codecov/patch

src/Groups/pcgroup.jl#L387-L391

Added lines #L387 - L391 were not covered by tests
end

0 comments on commit e9a4ac4

Please sign in to comment.