Skip to content

Commit

Permalink
Ensure ferret is used to solve stabilizer on setset problems
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJefferson committed Sep 1, 2024
1 parent fb159ed commit 3960a7b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lib/overloadmethods.gi
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,29 @@ PermGroupStabilizerFerretOp := function(arg)
acts:=arg[K-1];
gens:=arg[K-2];
d:=arg[K-3];

# If we are not currently trying ferret, exit straight away!
if not(_FERRET_ENABLE_OVERLOADS) then
return CallFuncList(PermGroupStabilizerOp, arg);
fi;
Info(InfoFerretOverloads, 2, "Considering ferret for Stabilizer");
Info(InfoFerretOverloads, 2, "Considering ferret for Stabilizer: ", arg);
if gens <> acts then
Info(InfoFerretOverloads, 2, "Rejected: generators and actions are different");
#TODO: Check whether acts is permutations and one could work in the
#permutation image (even if G is not permgroups)
TryNextMethod();
fi;

# These are easy and GAP has special methods to do them
if _YAPB_fastIsNaturalOrSymmetricGroup(G) then
if _YAPB_fastIsNaturalOrSymmetricGroup(G) and act = OnSets and ForAll( d, IsInt )
then
Info(InfoFerretOverloads, 2, "Rejected: Sets in the natural symmetric group");
TryNextMethod();
fi;

# First of all, lets dump some easy cases we don't want to handle
if act = OnPoints or act = OnPairs or act = OnTuples then
Info(InfoFerretOverloads, 2, "Rejected: acting on points, pairs or tuples");
return CallFuncList(PermGroupStabilizerOp, arg);
fi;

Expand Down Expand Up @@ -117,7 +121,7 @@ InstallOtherMethod( StabilizerOp, "permutation group with generators list",
IsList,
IsList,
IsFunction ],
# the objects might be a group element: rank up
# the objects might be a group element: rank up
{} -> RankFilter(IsMultiplicativeElementWithInverse)
# and we are better even if the group is solvable
+RankFilter(IsSolvableGroup) + 1,
Expand All @@ -129,29 +133,29 @@ InstallOtherMethod( StabilizerOp, "permutation group with domain",true,
IsList,
IsList,
IsFunction ],
# the objects might be a group element: rank up
# the objects might be a group element: rank up
{} -> RankFilter(IsMultiplicativeElementWithInverse)
# and we are better even if the group is solvable
+RankFilter(IsSolvableGroup) + 1,
PermGroupStabilizerFerretOp);



# This function replaces Intersection2 for perm groups
InstallMethod( Intersection2, "perm groups (from Ferret Package)", IsIdenticalObj,
[ IsPermGroup, IsPermGroup ], 1,
function( G, H )
local Omega, P, rbase, L,mg,mh,i;

if not(_FERRET_ENABLE_OVERLOADS) then
TryNextMethod();
fi;
Info(InfoFerretOverloads, 2, "Using ferret for Intersection2");

if IsIdenticalObj( G, H ) then
return G;
fi;

# These are easy and GAP has special methods to do them
if _YAPB_fastIsNaturalOrSymmetricGroup(G) and _YAPB_fastIsNaturalOrSymmetricGroup(H) then
TryNextMethod();
Expand All @@ -160,7 +164,7 @@ InstallOtherMethod( StabilizerOp, "permutation group with domain",true,
# Tighten bounds if possible
mg := LargestMovedPoint(G);
mh := LargestMovedPoint(H);

if mg <> mh then
if mg < mh then
H := Stabilizer(H, [mg+1..mh], OnTuples);
Expand Down
8 changes: 8 additions & 0 deletions tst/tstfiles/teststabsoverloads.tst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ gap> Stabilizer(g, [[1,2],[3]], OnTuplesTuples) = Group([(4,5),(6,7)]);
#I Considering ferret for Stabilizer
#I Considering ferret for Stabilizer
true
gap> Stabilizer(SymmetricGroup(5), [1,2,3,4], OnSets) = SymmetricGroup(4);
true
gap> Stabilizer(SymmetricGroup(5), [1,2,3], OnTuples) = SymmetricGroup([4..5]);
true
gap> Stabilizer(SymmetricGroup(5), [[1,2,3,4],[5]], OnSetsSets) = SymmetricGroup(4);
true
gap> Stabilizer(SymmetricGroup(5), [[1,2,3,4],[5]], OnSetsDisjointSets) = SymmetricGroup(4);
true
gap> SetInfoLevel(InfoFerretOverloads, 0);
gap> # Functions which GAP implements efficiently
gap> for i in [2..20] do
Expand Down

0 comments on commit 3960a7b

Please sign in to comment.