-
Notifications
You must be signed in to change notification settings - Fork 126
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
base: master
Are you sure you want to change the base?
Conversation
Moved from the mjrodgers-OW_GModules branch.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4202 +/- ##
========================================
Coverage 84.59% 84.60%
========================================
Files 631 640 +9
Lines 84899 85140 +241
========================================
+ Hits 71824 72032 +208
- Misses 13075 13108 +33
|
Thanks @jamesnohilly to clarify: what you posted in the description is not (yet) what you did, but a description of the work programme, right? Also, should mention that the code here was taken from PR #4108 by @fieker and is only the starting point. |
Yes, that's correct! I've now updated the description to make it clearer and also included a note that the code originates from PR #4108 as the starting point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments. Maybe more directed towards @fingolfin and @ThomasBreuer instead of @jamesnohilly
@jamesnohilly tests are still failing. are on onto that, or do you need assistance? |
src/Groups/pcgroup.jl
Outdated
julia> gg = pc_group(c) | ||
Pc group of order 6 | ||
|
||
julia> letters(gg[1]^5*gg[2]^-4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is not quite obvious for a reader. Better to show the intermediate result, that should make the connection to the output of letters
"obvious" :-)
julia> letters(gg[1]^5*gg[2]^-4) | |
julia> x = gg[1]^5*gg[2]^-4 | |
f1*f2^2 | |
julia> letters(x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I have updated the example in both syllables
and letters
to make this output clearer.
src/Groups/pcgroup.jl
Outdated
julia> gg = pc_group(c) | ||
Pc group of order 6 | ||
|
||
julia> syllables(gg[1]^5*gg[2]^-4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
julia> syllables(gg[1]^5*gg[2]^-4) | |
julia> x = gg[1]^5*gg[2]^-4 | |
f1*f2^2 | |
julia> syllables(x) |
src/Groups/pcgroup.jl
Outdated
julia> c = collector(2, Int); | ||
|
||
julia> Oscar.set_relative_orders!(c, [2, 3]) | ||
|
||
julia> Oscar.set_conjugate!(c, 2, 1, [2 => 2]) | ||
|
||
julia> gg = pc_group(c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface for construction collectors
is quite advanced and currently not even fully documented, so using it for an example is maybe not optimal. I suggest to use the small groups library to get a suitable example group instead, i.e. here we can just do this:
julia> c = collector(2, Int); | |
julia> Oscar.set_relative_orders!(c, [2, 3]) | |
julia> Oscar.set_conjugate!(c, 2, 1, [2 => 2]) | |
julia> gg = pc_group(c) | |
julia> gg = small_group(6,1) |
and then I think the rest of the example stays unchanged.
Same remark applies below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, no worries! I have now updated the examples with this replacement.
src/Groups/pcgroup.jl
Outdated
end | ||
|
||
# Convert syllables in canonical form into group element | ||
#Thomas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Thomas |
syllables(g::Union{PcGroupElem, SubPcGroupElem}) | ||
|
||
Return the syllables of `g` as a list of pairs of integers, each entry corresponding to | ||
a group generator and its exponent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also mention and/or demonstrate in the example how to go back? My understanding is that gg(syllables(x)) == x
, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's correct! I have added a small demonstration at the bottom of the example in the recent commit.
|
||
# Convert syllables in canonical form into group element | ||
#Thomas | ||
function (G::PcGroup)(sylls::Vector{Pair{Int64, ZZRingElem}}; check::Bool=true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a similar constructor which takes an exponent vector, i.e., an inverse to letters
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One needs to watch out for the semantic difference to the already existing function for FPGroups in
Oscar.jl/src/Groups/GAPGroups.jl
Line 2348 in 24711ee
function (G::FPGroup)(extrep::AbstractVector{T}) where T <: IntegerUnion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh, OK. perhaps we should kill that (is it documented?) first then. In GAP it made some sense to use such a flat list to avoid memory, as there are no tuples in GAP, only lists. But in Julia there is no real benefit of this over a Vector{Pair{Int64, ZZRingElem}}
.
But that is way beyond this PR. So let's leave out the constructor I mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not documented, but used for serialization. I haven't looked into how it is used there, so maybe we can just adapt the deserialization function, in the worst case it needs an upgrade script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh, OK. perhaps we should kill that (is it documented?) first then.
maybe @ThomasBreuer can look into that?
letters(g::Union{PcGroupElem, SubPcGroupElem}) | ||
|
||
Return the letters of `g` as a list of integers, each entry corresponding to | ||
a group generator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we can also produce negative numbers: e.g. -3 means "inverse of 3rd generator". This should be explained, and perhaps an example added showing that. E.g. based on this:
julia> x = (gg[1]*gg[2]*gg[3])^-2
g1*g2^-2*g3^3
Perhaps also add something like this (and then mirror it in the other function)
See also [`syllables`](@ref).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a small example with some brief explanation to letters
for this. However I am unsure if the example is good as I was not able to get elements with negative exponents and test.
src/Groups/pcgroup.jl
Outdated
end | ||
|
||
# Convert syllables in canonical form into exponent vector | ||
#Thomas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Thomas |
|
||
julia> gg(s) == x | ||
true | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are missing the three backticks here to end the doctest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! I have fixed it now, thanks!
This PR now unfortunately has conflicts with #4157. |
As a starting point for this PR, I've borrowed the
syllable
functions for PcGroup from PR #4108 to use as a reference for planned work.Planned work for this PR:
letters
for (Sub)PcGroupElem._exponent_vector
for whether the input is really "canonical".test/Groups/pcgroups.jl
for the new functions.Suggestions from @fingolfin