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

Speed up orbits of permutation groups on integers #4307

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
15 changes: 13 additions & 2 deletions src/Groups/gsets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,17 @@ orbit(G::GAPGroup, omega) = gset_by_type(G, [omega], typeof(omega))

orbit(G::Union{GAPGroup, FinGenAbGroup}, fun::Function, omega) = GSetByElements(G, fun, [omega])


function gap_action_function(Omega::GSet)
f = action_function(Omega)
(f == ^) && return GAP.Globals.OnPoints
f == on_tuples && return GAP.Globals.OnTuples
f == on_sets && return GAP.Globals.OnSets
# etc.
return GapObj(f) # generic fallback
end


"""
orbit(Omega::GSet, omega)

Expand All @@ -351,8 +362,8 @@ julia> length(orbit(Omega, 1))
"""
function orbit(Omega::GSetByElements{<:GAPGroup, S}, omega::S) where S
G = acting_group(Omega)
acts = GapObj(gens(G))
gfun = GapObj(action_function(Omega))
acts = GapObj(gens(G); recursive=true)
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
acts = GapObj(gens(G); recursive=true)
acts = [GapObj(g) for in gens(G)]

but even this will fail if g cannot be converted to a GAP object...

gfun = gap_action_function(Omega)

# The following works only because GAP does not check
# whether the given (dummy) group 'GapObj(G)' fits to the given generators,
Expand Down
11 changes: 11 additions & 0 deletions test/Groups/gsets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,17 @@ end
f = x^2 + y
orb = orbit(G, f)
@test length(orb) == 3


e = one(QQBar)
s, c = sincospi(2 * e / 3)
mat_rot = matrix([c -s; s c])
G = matrix_group(mat_rot)
p = QQBar.([1, 0])
orb = orbit(G, *, p)
@test length(orb) == 3


end

@testset "G-sets by right transversals" begin
Expand Down
Loading