diff --git a/gap/perm.gi b/gap/perm.gi
index d92017998..60e6dae00 100644
--- a/gap/perm.gi
+++ b/gap/perm.gi
@@ -347,24 +347,39 @@ end;
#! @BeginChunk ThrowAwayFixedPoints
#! This method defines a homomorphism of a permutation group
#! G to the action on the moved points of G if
-#! G does not have too many moved points. In the current setup, the
-#! homomorphism is defined if the number k of moved
+#! either G has a lot of fixed points, or if G knows that it is
+#! primitive and has fixed points. If G does not know whether it is
+#! primitive and has fixed points, then it returns NotEnoughInformation
+#! so that it may be called again at a later time.
+#! In all other cases, it returns NeverApplicable.
+#!
+#!
+#! In the current setup, the
+#! homomorphism is defined if the number n of moved
#! points is at most 1/3 of the largest moved point of G,
-#! or k is at most half of the number of points on which
-#! G is stored internally by ⪆. The method returns
-#! NeverApplicable if it does not define a homomorphism indicating that it will
-#! never succeed.
+#! or n is at most half of the number of points on which
+#! G is stored internally by ⪆.
#! @EndChunk
FindHomMethodsPerm.ThrowAwayFixedPoints :=
function( ri, G )
# Check, whether we can throw away fixed points
- local gens,hom,l,n,o;
+ local gens,nrStoredPoints,n,largest,isApplicable,o,hom;
gens := GeneratorsOfGroup(G);
- l := List(gens,StoredPointsPerm);
+ nrStoredPoints := Maximum(List(gens,StoredPointsPerm));
n := NrMovedPoints(G);
- if 2*n > Maximum(l) or 3*n > LargestMovedPoint(G) then # we do nothing
- return NeverApplicable;
+ largest := LargestMovedPoint(G);
+ # If isApplicable is true, we definitely are applicable.
+ isApplicable := 3*n <= largest or 2*n <= nrStoredPoints
+ or (HasIsPrimitive(G) and IsPrimitive(G) and n < largest);
+ # If isApplicable is false, we might become applicable if G figures out
+ # that it is primitive.
+ if not isApplicable then
+ if not HasIsPrimitive(G) and n < largest then
+ return NotEnoughInformation;
+ else
+ return NeverApplicable;
+ fi;
fi;
o := MovedPoints(G);
hom := ActionHomomorphism(G,o);
diff --git a/gap/perm/largebase.gi b/gap/perm/largebase.gi
index cf854f525..2d690320f 100644
--- a/gap/perm/largebase.gi
+++ b/gap/perm/largebase.gi
@@ -507,6 +507,14 @@ end;
#! r \cdot k > 1
#! and 2 \cdot r \cdot k^2 \le n.
#!
+#! A large primitive group Hof the above type which does have fixed
+#! points is handled as follows. After a call of LargeBasePrimitive,
+#! the group H knows that it is primitive. Thus, after
+#! LargeBasePrimitive returns NeverApplicable, the function
+#! will prune away the fixed points and set
+#! up a homomorphism. LargeBasePrimitive is then applicable to the image
+#! of that homomorphism.
+#!
#! If G is imprimitive then the output is
#! NeverApplicable. If G is primitive then
#! the output is either a homomorphism into the
@@ -526,6 +534,7 @@ FindHomMethodsPerm.LargeBasePrimitive :=
fi;
RECOG.SetPseudoRandomStamp(grp,"Jellyfish");
res := RECOG.AllJellyfish(grp);
+ RECOG.SetPseudoRandomStamp(grp,"PseudoRandom");
if res = NeverApplicable or res = TemporaryFailure then
return res;
fi;
diff --git a/tst/working/quick/PermLargeBasePrimitive.tst b/tst/working/quick/PermLargeBasePrimitive.tst
index fed7adf6c..6eb02d382 100644
--- a/tst/working/quick/PermLargeBasePrimitive.tst
+++ b/tst/working/quick/PermLargeBasePrimitive.tst
@@ -1,4 +1,5 @@
#@local S19OnSets, jellyGroup, n, random, jellyGroupConj, ri
+#@local addFixedPointsPerm, jellyGroupWithFixedPoints, riWithFixed
# Test for LargeBasePrimitive
gap> S19OnSets := Action(SymmetricGroup(19), Combinations([1 .. 19], 2), OnSets);;
@@ -7,7 +8,22 @@ gap> n := NrMovedPoints(jellyGroup);;
gap> # Take a random conjugate
gap> random := Random(SymmetricGroup(n));;
gap> jellyGroupConj := jellyGroup ^ random;;
-gap> RECOG.TestGroup(jellyGroupConj,
+gap> ri := RECOG.TestGroup(jellyGroupConj,
> false,
> Size(jellyGroup),
> rec(tryNonGroupElements := true));;
+gap> ri!.fhmethsel.successMethod;
+"LargeBasePrimitive"
+
+# Test that groups with fixed points are handled together by
+# ThrowAwayFixedPoints and LargeBasePrimitive.
+gap> addFixedPointsPerm := Random(SymmetricGroup(5 * QuoInt(n,2)));;
+gap> jellyGroupWithFixedPoints := jellyGroup ^ addFixedPointsPerm;;
+gap> riWithFixed := RECOG.TestGroup(jellyGroupWithFixedPoints,
+> false,
+> Size(jellyGroup),
+> rec(tryNonGroupElements := true));;
+gap> riWithFixed!.fhmethsel.successMethod;
+"ThrowAwayFixedPoints"
+gap> RIFac(riWithFixed)!.fhmethsel.successMethod;
+"LargeBasePrimitive"