Skip to content

Commit

Permalink
Fix Orbits with a range as seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 14, 2022
1 parent 32d42ef commit 0a20c1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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 ] ]

0 comments on commit 0a20c1b

Please sign in to comment.