-
Notifications
You must be signed in to change notification settings - Fork 162
Add encode and pc_group for encoding finite pc groups into integers and back
#5456
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
base: master
Are you sure you want to change the base?
Changes from 13 commits
90bc8c5
f76780b
a216c4e
4cb5b93
744d0bc
eeaddfd
ad08e81
dd10a1b
876a802
eb3233a
a9aa27c
018769f
f3f9745
e1873c7
49934f3
c452989
b7fec6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -923,3 +923,57 @@ function collector(::Type{T}, G::PcGroup) where T <: IntegerUnion | |||||||
| end | ||||||||
|
|
||||||||
| collector(G::PcGroup) = collector(ZZRingElem, G) | ||||||||
|
|
||||||||
| # GAP wrappers for group encoding / decoding | ||||||||
|
|
||||||||
| """ | ||||||||
| encode(G::PcGroup) | ||||||||
|
|
||||||||
| Return a `ZZRingElem` representing the polycyclic group `G`, | ||||||||
| using the same encoding as GAP's `CodePcGroup` and Magma's `SmallGroupEncoding`. | ||||||||
| Currently only defined for `PcGroup`, not `SubPcGroup`. | ||||||||
|
|
||||||||
| # Examples | ||||||||
| ```jldoctest | ||||||||
| julia> G = small_group(12, 2) | ||||||||
| Pc group of order 12 | ||||||||
|
|
||||||||
| julia> code = encode(G) | ||||||||
| 266 | ||||||||
|
|
||||||||
| julia> H = pc_group(order(G), code) | ||||||||
| Pc group of order 12 | ||||||||
|
|
||||||||
| julia> encode(G) == encode(H) | ||||||||
| true | ||||||||
| ``` | ||||||||
| """ | ||||||||
| function encode(G::PcGroup) | ||||||||
| return ZZ(GAP.Globals.CodePcGroup(GapObj(G))::GapInt) | ||||||||
| end | ||||||||
|
|
||||||||
| """ | ||||||||
| pc_group(order::IntegerUnion, code::IntegerUnion) | ||||||||
|
|
||||||||
| Given an integer `order` and an integer `code`, return the polycyclic group it encodes. | ||||||||
| Both `order` and `code` can be of type `Int`, `BigInt`, or `ZZRingElem`. | ||||||||
| The accepted codes and resulting groups match those of GAP's `PcGroupCode` and Magma's `SmallGroupDecoding`. | ||||||||
|
|
||||||||
| # Examples | ||||||||
| ```jldoctest | ||||||||
| julia> G = small_group(12, 2) | ||||||||
| Pc group of order 12 | ||||||||
|
|
||||||||
| julia> code = encode(G) | ||||||||
| 266 | ||||||||
|
|
||||||||
| julia> H = pc_group(order(G), code) | ||||||||
| Pc group of order 12 | ||||||||
|
|
||||||||
| julia> encode(G) == encode(H) | ||||||||
| true | ||||||||
| ``` | ||||||||
| """ | ||||||||
lgoettgens marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| function pc_group(order::IntegerUnion, code::IntegerUnion) | ||||||||
| return PcGroup(GAP.Globals.PcGroupCode(GAP.GapInt(BigInt(code)),GAP.GapInt(BigInt(order)))) | ||||||||
|
||||||||
| return PcGroup(GAP.Globals.PcGroupCode(GAP.GapInt(BigInt(code)),GAP.GapInt(BigInt(order)))) | |
| return PcGroup(GAP.Globals.PcGroupCode(GapInt(code), GapInt(order))) |
At the same time, please change
Line 38 in c0fadd1
| GAP = "0.16.0" |
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.
GAP.jl 0.16.1 is out now, so this can be done.
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.