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

Fix Orbits when called with a range as seeds #5057

Merged
merged 1 commit into from
Sep 21, 2022
Merged
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
7 changes: 5 additions & 2 deletions lib/oprt.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ end );

InstallMethod( Orbits, "for arbitrary domains", true, OrbitsishReq, 0,
function( G, D, gens, acts, act )
local orbs, orb,sort,plist,pos,use,o,nc,ld,ld1;
local orbs, orb,sort,plist,pos,use,o,nc,ld,ld1,pc;

sort:=Length(D)>0 and CanEasilySortElements(D[1]);
plist:=IsPlistRep(D);
Expand All @@ -1691,7 +1691,10 @@ local orbs, orb,sort,plist,pos,use,o,nc,ld,ld1;
fi;
else
for o in orb do
use[PositionCanonical(D,o)]:=true;
pc:=PositionCanonical(D,o);
if pc <> fail then
use[pc]:=true;
fi;
od;
# not plist -- do not take difference as there may be special
# `PositionCanonical' method.
Expand Down
7 changes: 7 additions & 0 deletions tst/testbugfix/2022-09-15-Orbits.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Verify that Orbits works when the given seeds are a range
# See https://github.com/gap-system/gap/issues/5056
gap> act := function(omega,g) return PowerModInt(omega,Int(g),15); end;;
gap> ugrp := Units(ZmodnZ(Phi(15)));
<group of size 4 with 2 generators>
gap> orbs := Orbits(ugrp,[1..5],act);
[ [ 1 ], [ 2, 8 ], [ 3, 12 ], [ 4 ], [ 5 ] ]