Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add letters function for PcGroupElem #4202

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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
Loading