Skip to content

Commit

Permalink
ENHANCE: Orbit calculation may keep permutations
Browse files Browse the repository at this point in the history
using an option, if they are obtained for free during the calculation
  • Loading branch information
hulpke committed Apr 5, 2024
1 parent d06e4eb commit 49625cd
Showing 1 changed file with 53 additions and 9 deletions.
62 changes: 53 additions & 9 deletions lib/oprt.gi
Original file line number Diff line number Diff line change
Expand Up @@ -985,11 +985,24 @@ end );

InstallMethod( OrbitOp, "with domain", true, OrbitishReq,0,
function( G, D, pnt, gens, acts, act )
local orb,d,gen,i,p;
local orb,d,gen,i,p,permrec,perms;
# is there an option indicating a wish to calculate permutations?
permrec:=ValueOption("permutations");
if permrec<>fail then
if not IsRecord(permrec) then
Error("asks for permutations, but no record given");
fi;
perms:=List(gens,x->[]);
permrec.generators:=gens;
permrec.permutations:=perms;
fi;

pnt:=Immutable(pnt);
d:=NewDictionary(pnt,false,D);
orb := [ pnt ];
AddDictionary(d,pnt);
if permrec=fail then
d:=NewDictionary(pnt,false,D);
AddDictionary(d,pnt);
fi;
for p in orb do
for gen in acts do
i:=act(p,gen);
Expand All @@ -1010,20 +1023,51 @@ InstallOtherMethod( OrbitOp, "standard orbit algorithm:list", true,
IsList,
IsFunction ], 0,
function( G, pnt, gens, acts, act )
local orb,d,gen,i,p,D;
local orb,d,gen,i,p,D,perms,permrec,gp,op,l;
# is there an option indicating a wish to calculate permutations?
permrec:=ValueOption("permutations");
if permrec<>fail then
if not IsRecord(permrec) then
Error("asks for permutations, but no record given");
fi;
perms:=List(gens,x->[]);
permrec.generators:=gens;
permrec.permutations:=perms;
fi;

# try to find a domain
D:=DomainForAction(pnt,acts,act);
pnt:=Immutable(pnt);
d:=NewDictionary(pnt,false,D);
orb := [ pnt ];
AddDictionary(d,pnt);
if permrec=fail then
d:=NewDictionary(pnt,false,D);
AddDictionary(d,pnt);
else
d:=NewDictionary(pnt,true,D);
AddDictionary(d,pnt,1);
fi;
op:=0;
for p in orb do
op:=op+1;
gp:=0;
for gen in acts do
gp:=gp+1;
i:=act(p,gen);
MakeImmutable(i);
if not KnowsDictionary(d,i) then
Add( orb, i );
AddDictionary(d,i);
if permrec=fail then
if not KnowsDictionary(d,i) then
Add( orb, i );
AddDictionary(d,i);
fi;
else
l:=LookupDictionary(d,i);
if l=fail then
Add( orb, i );
AddDictionary(d,i,Length(orb));
perms[gp][op]:=Length(orb);
else
perms[gp][op]:=l;
fi;
fi;
od;
od;
Expand Down

0 comments on commit 49625cd

Please sign in to comment.