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

more functionality for collector objects #4157

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
60 changes: 60 additions & 0 deletions src/Groups/pcgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,63 @@ function pc_group(c::GAP_Collector)
end
end


# Create an Oscar collector from a GAP collector.

"""
collector([::Type{T} = ZZRingElem, ]G::PcGroup) where T <: IntegerUnion

Return a collector object for `G`.

# Examples
```jldoctest
julia> g = small_group(12, 3)
Pc group of order 12

julia> c = collector(g);

julia> gc = pc_group(c)
Pc group of order 12

julia> is_isomorphic(g, gc)
true
```
"""
function collector(::Type{T}, G::PcGroup) where T <: IntegerUnion
Fam = GAPWrap.ElementsFamily(GAPWrap.FamilyObj(GapObj(G)))
GapC = GAP.getbangproperty(Fam, :rewritingSystem)::GapObj

n = GAP.getbangindex(GapC, 3)::Int
c = collector(n, T)

c.relorders = Vector{T}(GAP.getbangindex(GapC, 6)::GapObj)

Gap_powers = GAP.gap_to_julia(GAP.getbangindex(GapC, 7)::GapObj, recursive = false)
for i in 1:length(Gap_powers)
if Gap_powers[i] !== nothing
l = GAPWrap.ExtRepOfObj(Gap_powers[i])
c.powers[i] = Pair{Int,T}[l[k-1] => T(l[k]) for k in 2:2:length(l)]
end
end

Gap_conj = GAP.gap_to_julia(GAP.getbangindex(GapC, 8)::GapObj, recursive = false)
for i in 1:length(Gap_conj)
Gap_conj_i = GAP.gap_to_julia(Gap_conj[i]::GapObj, recursive = false)
for j in 1:length(Gap_conj_i)
if Gap_conj_i[j] !== nothing
l = GAPWrap.ExtRepOfObj(Gap_conj_i[j])
c.conjugates[j,i] = Pair{Int,T}[l[k-1] => T(l[k]) for k in 2:2:length(l)]
end
end
end

# c.X = GapC
# c.F = FPGroup(GAP.getbangproperty(GAP.getbangindex(GapC, 1)::GapObj, :freeGroup)::GapObj)
#TODO: Set these known data.
# Currently this does not work because somehow `GroupByRws`
# requires a *mutable* GAP collector, and `GapC` is immutable.

return c
end

collector(G::PcGroup) = collector(ZZRingElem, G)
10 changes: 10 additions & 0 deletions test/Groups/pcgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,13 @@ end
@test GAP.Globals.IsMutable(cgg)
@test cgg !== c.X
end

@testset "create collectors from polycyclic groups" begin
for i in rand(1:number_small_groups(96), 10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for i in rand(1:number_small_groups(96), 10)
for i in rand(1:number_of_small_groups(96), 10)

the old version is deprecated

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o.k.

g = small_group(96, i)
c = collector(Int64, g)
gc = pc_group(c)
f = hom(g, gc, gens(gc))
@test is_bijective(f)
end
end
Loading