Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ AbstractAlgebra = "0.47.4"
AlgebraicSolving = "0.10.0"
Compat = "4.13.0"
Distributed = "1.6"
GAP = "0.16.0"
GAP = "0.16.1"
Hecke = "0.39.1"
JSON = "1.0.1"
JSON3 = "1.13.2"
Expand Down
53 changes: 53 additions & 0 deletions src/Groups/pcgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -923,3 +923,56 @@ 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.
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
```
"""
function pc_group(order::IntegerUnion, code::IntegerUnion)
return PcGroup(GAP.Globals.PcGroupCode(GapInt(code), GapInt(order)))
end
1 change: 1 addition & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ export elliptic_parameter
export elliptic_surface
export embedding
export embedding_orthogonal_group
export encode
export enriques_surface_automorphism_group
export enumerate_classes_of_lattices_with_isometry
export epimorphism_from_free_group
Expand Down
17 changes: 17 additions & 0 deletions test/Groups/pcgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,20 @@ end
@test is_bijective(f)
end
end

@testset "pcgroup code and reconstruction" begin
groups = [
cyclic_group(6),
cyclic_group(12),
dihedral_group(10),
small_group(PcGroup, 12, 2)
]

for G in groups
code = encode(G)
H = pc_group(order(G), code)
@test hom(G, H, gens(H)) isa Map
@test order(G) == order(H)
@test encode(H) == code
end
end
Loading