Skip to content

Commit

Permalink
Adjust InstallMethod calls depending on RankFilter
Browse files Browse the repository at this point in the history
... to use a rank *function* instead of a single fixed rank value.
  • Loading branch information
fingolfin committed Sep 14, 2018
1 parent 1762043 commit 6a81396
Show file tree
Hide file tree
Showing 23 changed files with 64 additions and 64 deletions.
6 changes: 3 additions & 3 deletions lib/coll.gd
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ InstallMethod( UseSubsetRelation,
IsIdenticalObj,
[ IsCollection, IsCollection ],
# Make sure that this method is installed with ``real'' rank zero.
- 2 * RankFilter( IsCollection ),
{} -> - 2 * RankFilter( IsCollection ),
function( super, sub )

local entry;
Expand Down Expand Up @@ -777,7 +777,7 @@ InstallMethod( UseIsomorphismRelation,
"default method that checks maintenances and then returns `true'",
[ IsCollection, IsCollection ],
# Make sure that this method is installed with ``real'' rank zero.
- 2 * RankFilter( IsCollection ),
{} -> - 2 * RankFilter( IsCollection ),
function( old, new )
local entry;

Expand Down Expand Up @@ -941,7 +941,7 @@ InstallMethod( UseFactorRelation,
true,
[ IsCollection, IsObject, IsCollection ],
# Make sure that this method is installed with ``real'' rank zero.
- 2 * RankFilter( IsCollection )-RankFilter(IsObject),
{} -> - 2 * RankFilter( IsCollection )-RankFilter(IsObject),
function( num, den, fac )

local entry;
Expand Down
4 changes: 2 additions & 2 deletions lib/ctblsolv.gi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
InstallMethod( CharacterDegrees,
"for an abelian group, and an integer p (just strip off the p-part)",
[ IsGroup and IsAbelian, IsInt ],
RankFilter(IsZeroCyc), # There is a method for groups for
{} -> RankFilter(IsZeroCyc), # There is a method for groups for
# the integer zero which is worse
function( G, p )
G:= Size( G );
Expand Down Expand Up @@ -482,7 +482,7 @@ BindGlobal( "CharacterDegreesConlon", function( G, q )
InstallMethod( CharacterDegrees,
"for a solvable group and an integer (Conlon's algorithm)",
[ IsGroup and IsSolvableGroup, IsInt ],
RankFilter(IsZeroCyc), # There is a method for groups for
{} -> RankFilter(IsZeroCyc), # There is a method for groups for
# the integer zero which is worse
function( G, q )
if HasIrr( G ) then
Expand Down
4 changes: 2 additions & 2 deletions lib/ghom.gi
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ InstallMethod( ImagesSource, "for group homomorphism", true,
[ IsGroupHomomorphism ],
# rank higher than the method for IsGroupGeneralMappingByImages,
# as we can exploit more structure here
RankFilter(IsGroupHomomorphism and IsGroupGeneralMappingByImages)
- RankFilter(IsGroupHomomorphism),
{} -> RankFilter(IsGroupHomomorphism and IsGroupGeneralMappingByImages)
- RankFilter(IsGroupHomomorphism),
function(hom)
local gens, G;
gens := GeneratorsOfGroup(Source(hom));
Expand Down
16 changes: 8 additions & 8 deletions lib/gpprmsya.gi
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ end );
InstallOtherMethod( RepresentativeActionOp, "natural alternating group",
true, [ IsNaturalAlternatingGroup, IsObject, IsObject, IsFunction ],
# the objects might be group elements: rank up
2*RankFilter(IsMultiplicativeElementWithInverse),
{} -> 2*RankFilter(IsMultiplicativeElementWithInverse),
function ( G, d, e, opr )
local dom,dom2,sortfun,max,cd,ce,rep,dp,ep;
# test for internal rep
Expand Down Expand Up @@ -993,21 +993,21 @@ end;
InstallOtherMethod( StabilizerOp,"symmetric group", true,
[ IsNaturalSymmetricGroup, IsObject, IsList, IsList, IsFunction ],
# the objects might be a group element: rank up
RankFilter(IsMultiplicativeElementWithInverse) +
{} -> RankFilter(IsMultiplicativeElementWithInverse) +
RankFilter(IsSolvableGroup),
SYMGP_STABILIZER);

InstallOtherMethod( StabilizerOp,"symmetric group", true,
[ IsNaturalSymmetricGroup, IsDomain, IsObject, IsList, IsList, IsFunction ],
# the objects might be a group element: rank up
RankFilter(IsMultiplicativeElementWithInverse) +
{} -> RankFilter(IsMultiplicativeElementWithInverse) +
RankFilter(IsSolvableGroup),
SYMGP_STABILIZER);

InstallOtherMethod( StabilizerOp,"alternating group", true,
[ IsNaturalAlternatingGroup, IsObject, IsList, IsList, IsFunction ],
# the objects might be a group element: rank up
RankFilter(IsMultiplicativeElementWithInverse) +
{} -> RankFilter(IsMultiplicativeElementWithInverse) +
RankFilter(IsSolvableGroup),
function(g, arg...)
local s;
Expand All @@ -1023,7 +1023,7 @@ end);
InstallOtherMethod( StabilizerOp,"alternating group", true,
[ IsNaturalAlternatingGroup, IsDomain, IsObject, IsList, IsList, IsFunction ],
# the objects might be a group element: rank up
RankFilter(IsMultiplicativeElementWithInverse) +
{} -> RankFilter(IsMultiplicativeElementWithInverse) +
RankFilter(IsSolvableGroup),
function(g, arg...)
return AlternatingSubgroup(CallFuncList(Stabilizer, Concatenation([SymmetricParentGroup(g)], arg)));
Expand Down Expand Up @@ -1559,7 +1559,7 @@ end);
InstallOtherMethod( RepresentativeActionOp, "for natural symmetric group",
true, [ IsNaturalSymmetricGroup, IsObject, IsObject, IsFunction ],
# the objects might be group elements: rank up
2*RankFilter(IsMultiplicativeElementWithInverse),
{} -> 2*RankFilter(IsMultiplicativeElementWithInverse),
function ( G, d, e, opr )
local dom,n,sortfun,max,cd,ce,p1,p2;
# test for internal rep
Expand Down Expand Up @@ -2452,7 +2452,7 @@ InstallMethod( RadicalGroup, "alternating", true,
InstallMethod(NormalSubgroups,
"for a symmetric group",
[IsSymmetricGroup],
RankFilter(IsPermGroup),
{} -> RankFilter(IsPermGroup),
function(S)
if SymmetricDegree(S) <= 4 then
# S is soluble, so this includes the trivial group (and Klein 4)
Expand All @@ -2465,7 +2465,7 @@ end);
InstallMethod(NormalSubgroups,
"for an alternating group",
[IsAlternatingGroup],
RankFilter(IsPermGroup),
{} -> RankFilter(IsPermGroup),
function(A)
if AlternatingDegree(A) <= 4 then
# S is soluble, so this includes the trivial group (and Klein 4)
Expand Down
10 changes: 5 additions & 5 deletions lib/gprd.gi
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,15 @@ InstallGlobalFunction (PcgsDirectProduct,

InstallMethod( Pcgs, "for direct products", true,
[IsGroup and HasDirectProductInfo],
Maximum(
{} -> Maximum(
RankFilter(IsPcGroup),
RankFilter(IsPermGroup and IsSolvableGroup)
),# this is better than these two common alternatives
D -> PcgsDirectProduct (D, Pcgs, fail, fail));

InstallMethod( PcgsElementaryAbelianSeries, "for direct products", true,
[IsGroup and HasDirectProductInfo],
Maximum(
{} -> Maximum(
RankFilter(IsPcGroup),
RankFilter(IsPermGroup and IsSolvableGroup)
),# this is better than these two common alternatives
Expand All @@ -408,7 +408,7 @@ InstallMethod( PcgsElementaryAbelianSeries, "for direct products", true,

InstallMethod( PcgsCentralSeries, "for direct products", true,
[IsGroup and HasDirectProductInfo],
Maximum(
{} -> Maximum(
RankFilter(IsPcGroup),
RankFilter(IsPermGroup and IsSolvableGroup)
),# this is better than these two common alternatives
Expand All @@ -420,7 +420,7 @@ InstallMethod( PcgsCentralSeries, "for direct products", true,

InstallMethod( PcgsChiefSeries, "for direct products", true,
[IsGroup and HasDirectProductInfo],
Maximum(
{} -> Maximum(
RankFilter(IsPcGroup),
RankFilter(IsPermGroup and IsSolvableGroup)
),# this is better than these two common alternatives
Expand All @@ -429,7 +429,7 @@ InstallMethod( PcgsChiefSeries, "for direct products", true,

InstallMethod( PcgsPCentralSeriesPGroup, "for direct products", true,
[IsGroup and HasDirectProductInfo],
Maximum(
{} -> Maximum(
RankFilter(IsPcGroup),
RankFilter(IsPermGroup and IsSolvableGroup)
),# this is better than these two common alternatives
Expand Down
10 changes: 5 additions & 5 deletions lib/grp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ InstallMethod( IsCyclic,
InstallMethod( Size,
"for a cyclic group",
[ IsGroup and IsCyclic and HasGeneratorsOfGroup ],
-RankFilter(HasGeneratorsOfGroup),
{} -> -RankFilter(HasGeneratorsOfGroup),
function(G)
local gens;
if HasMinimalGeneratingSet(G) then
Expand All @@ -95,7 +95,7 @@ end);

InstallMethod( MinimalGeneratingSet,"finite cyclic groups",true,
[ IsGroup and IsCyclic and IsFinite ],
RankFilter(IsFinite and IsPcGroup),
{} -> RankFilter(IsFinite and IsPcGroup),
function ( G )
local g;
if IsTrivial(G) then return []; fi;
Expand Down Expand Up @@ -1956,7 +1956,7 @@ InstallMethod( Socle, "for elementary abelian groups",
##
InstallMethod( Socle, "for nilpotent groups",
[ IsGroup and IsNilpotentGroup ],
RankFilter( IsGroup and IsFinite and IsNilpotentGroup )
{} -> RankFilter( IsGroup and IsFinite and IsNilpotentGroup )
- RankFilter( IsGroup and IsNilpotentGroup ),
function(G)
local P, C, size, gen, abinv, indgen, i, p, q, soc;
Expand Down Expand Up @@ -2616,7 +2616,7 @@ InstallMethod( IndexNC,
"for two groups with known Size value",
IsIdenticalObj,
[ IsGroup and HasSize, IsGroup and HasSize and IsFinite ],
2 * RankFilter( IsHandledByNiceMonomorphism ),
{} -> 2 * RankFilter( IsHandledByNiceMonomorphism ),
function( G, H )
return Size( G ) / Size( H );
end );
Expand Down Expand Up @@ -4952,7 +4952,7 @@ InstallMethod( MinimalNormalSubgroups, "for nilpotent groups",
# IsGroup and IsFinite ranks higher than IsGroup and IsNilpotentGroup
# so we have to increase the rank, otherwise the method for computation
# by conjugacy classes above is selected.
RankFilter( IsGroup and IsFinite and IsNilpotentGroup )
{} -> RankFilter( IsGroup and IsFinite and IsNilpotentGroup )
- RankFilter( IsGroup and IsNilpotentGroup ),
function(G)
local soc, i, p, primes, gen, min, MinimalSubgroupsOfPGroupByGenerators;
Expand Down
6 changes: 3 additions & 3 deletions lib/grpfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,7 @@ InstallMethod(LowIndexSubgroups, "FpFroups, using LowIndexSubgroupsFpGroup",
true,
[IsSubgroupFpGroup,IsPosInt],
# rank higher than method for finit groups using maximal subgroups
RankFilter(IsGroup and IsFinite),
{} -> RankFilter(IsGroup and IsFinite),
LowIndexSubgroupsFpGroup );

InstallOtherMethod(LowIndexSubgroupsFpGroup,
Expand Down Expand Up @@ -4115,15 +4115,15 @@ InstallMethod(IsomorphismPermGroup,"for full finitely presented groups",
true, [ IsGroup and IsSubgroupFpGroup and IsGroupOfFamily ],
# as this method may be called to compare elements we must get higher
# than a method for finite groups (via right multiplication).
RankFilter(IsFinite and IsGroup),
{} -> RankFilter(IsFinite and IsGroup),
function(G)
return IsomorphismPermGroupOrFailFpGroup(G,10^30);
end);

InstallMethod(IsomorphismPermGroup,"for subgroups of finitely presented groups",
true, [ IsGroup and IsSubgroupFpGroup ],
# even if we don't demand to know to be finite, we have to assume it.
RankFilter(IsFinite and IsGroup),
{} -> RankFilter(IsFinite and IsGroup),
function(G)
local P,imgs,hom;
Size(G);
Expand Down
2 changes: 1 addition & 1 deletion lib/grpnice.gi
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ InstallMethod(NiceMonomorphism,
"for subgroups that get the nice monomorphism by their parent", true,
[ IsGroup and IsHandledByNiceMonomorphism and HasParent],
# to rank higher than matrix group methods.
RankFilter(IsFinite and IsMatrixGroup),
{} -> RankFilter(IsFinite and IsMatrixGroup),

function(G)
local P;
Expand Down
4 changes: 2 additions & 2 deletions lib/grppc.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2220,7 +2220,7 @@ InstallMethod(IsSimpleGroup,"for solvable groups",true,
[IsSolvableGroup],
# this is also better for permutation groups, so we increase the value to
# be above the value for `IsPermGroup'.
Maximum(RankFilter(IsSolvableGroup),
{} -> Maximum(RankFilter(IsSolvableGroup),
RankFilter(IsPermGroup)+1)
-RankFilter(IsSolvableGroup),
function(G)
Expand Down Expand Up @@ -2401,7 +2401,7 @@ end);
##
InstallMethod(MinimalGeneratingSet,
"compute via Smith normal form",
[IsGroup and CanEasilyComputePcgs and IsAbelian], RankFilter (IsPcGroup),
[IsGroup and CanEasilyComputePcgs and IsAbelian], {} -> RankFilter(IsPcGroup),
function(G)

local pcgs, matrix, snf, gens, cti, row, g, i;
Expand Down
4 changes: 2 additions & 2 deletions lib/grppcatr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ InstallMethod( MaximalNormalSubgroups, "for abelian groups",
# IsGroup and IsFinite ranks higher than IsGroup and IsAbelian,
# so we have to increase the rank, otherwise the method for
# normal subgroup computation is selected.
RankFilter( IsGroup and IsFinite and IsAbelian )
{} -> RankFilter( IsGroup and IsFinite and IsAbelian )
- RankFilter( IsGroup and IsAbelian ),
function( G )
local Gf, # FactorGroup of G
Expand Down Expand Up @@ -523,7 +523,7 @@ InstallMethod( MaximalNormalSubgroups, "for solvable groups",
# IsGroup and IsSolvableGroup, so we have to increase the
# rank, otherwise the method for normal subgroup computation
# is selected.
RankFilter( IsGroup and IsFinite and IsSolvableGroup )
{} -> RankFilter( IsGroup and IsFinite and IsSolvableGroup )
- RankFilter( IsGroup and IsSolvableGroup ),
function( G )
local Gf, # FactorGroup of G
Expand Down
2 changes: 1 addition & 1 deletion lib/grppccom.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ end);
##
InstallMethod( ComplementClassesRepresentatives,
"tell that the normal subgroup or factor must be solvable", IsIdenticalObj,
[ IsGroup, IsGroup ], -2*RankFilter(IsGroup),
[ IsGroup, IsGroup ], {} -> -2*RankFilter(IsGroup),
function( G, N )
if IsSolvableGroup(N) or HasSolvableFactorGroup(G, N) then
TryNextMethod();
Expand Down
8 changes: 4 additions & 4 deletions lib/idealalg.gi
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ InstallMethod( GeneratorsOfLeftModule,
"for FLMLOR with known left ideal generators",
true,
[ IsFLMLOR and HasGeneratorsOfLeftIdeal ],
RankFilter( HasGeneratorsOfTwoSidedIdeal ),
{} -> RankFilter( HasGeneratorsOfTwoSidedIdeal ),
I -> LeftModuleGeneratorsForIdealFromGenerators( I,
GeneratorsOfLeftIdeal( I ),
LeftActingRingOfIdeal( I ), "left" ) );
Expand All @@ -416,7 +416,7 @@ InstallMethod( GeneratorsOfLeftModule,
"for FLMLOR with known right ideal generators",
true,
[ IsFLMLOR and HasGeneratorsOfRightIdeal ],
RankFilter( HasGeneratorsOfTwoSidedIdeal ),
{} -> RankFilter( HasGeneratorsOfTwoSidedIdeal ),
I -> LeftModuleGeneratorsForIdealFromGenerators( I,
GeneratorsOfRightIdeal( I ),
RightActingRingOfIdeal( I ), "right" ) );
Expand All @@ -434,7 +434,7 @@ InstallMethod( GeneratorsOfLeftOperatorRing,
"for FLMLOR with known left ideal generators",
true,
[ IsFLMLOR and HasGeneratorsOfLeftIdeal ],
RankFilter( HasGeneratorsOfTwoSidedIdeal ),
{} -> RankFilter( HasGeneratorsOfTwoSidedIdeal ),
I -> LeftModuleGeneratorsForIdealFromGenerators( I,
GeneratorsOfLeftIdeal( I ),
LeftActingRingOfIdeal( I ), "left" ) );
Expand All @@ -443,7 +443,7 @@ InstallMethod( GeneratorsOfLeftOperatorRing,
"for FLMLOR with known right ideal generators",
true,
[ IsFLMLOR and HasGeneratorsOfRightIdeal ],
RankFilter( HasGeneratorsOfTwoSidedIdeal ),
{} -> RankFilter( HasGeneratorsOfTwoSidedIdeal ),
I -> LeftModuleGeneratorsForIdealFromGenerators( I,
GeneratorsOfRightIdeal( I ),
RightActingRingOfIdeal( I ), "right" ) );
Expand Down
4 changes: 2 additions & 2 deletions lib/matobj.gi
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
# so that these are only used as a last resort.
InstallMethod( \[\], "for a matrix object and two positions",
[ IsMatrixObj, IsPosInt, IsPosInt ],
-RankFilter(IsMatrixObj),
{} -> -RankFilter(IsMatrixObj),
function( m, row, col )
return MatElm( m, row, col );
end );

InstallMethod( \[\]\:\=, "for a matrix object, two positions, and an object",
[ IsMatrixObj and IsMutable, IsPosInt, IsPosInt, IsObject ],
-RankFilter(IsMatrixObj),
{} -> -RankFilter(IsMatrixObj),
function( m, row, col, obj )
SetMatElm( m, row, col, obj );
end );
Expand Down
4 changes: 2 additions & 2 deletions lib/morpheus.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ end);
#M AutomorphismGroup(<G>) . . abelian case
##
InstallMethod(AutomorphismGroup,"test abelian",true,[IsGroup and IsFinite],
RankFilter(IsSolvableGroup and IsFinite),
{} -> RankFilter(IsSolvableGroup and IsFinite),
function(G)
local A;
if not IsAbelian(G) then
Expand All @@ -2075,7 +2075,7 @@ end);
#M AutomorphismGroup(<G>) . . abelian case
##
InstallMethod(AutomorphismGroup,"test abelian",true,[IsGroup and IsFinite],
RankFilter(IsSolvableGroup and IsFinite),
{} -> RankFilter(IsSolvableGroup and IsFinite),
function(G)
local A;
if not IsAbelian(G) then
Expand Down
6 changes: 3 additions & 3 deletions lib/oprtperm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ InstallTrueMethod(IsRegular,IsPermGroup and IsSemiRegular and IsTransitive);
InstallOtherMethod( RepresentativeActionOp, "permgrp",true, [ IsPermGroup,
IsObject, IsObject, IsFunction ],
# the objects might be group elements: rank up
2*RankFilter(IsMultiplicativeElementWithInverse),
{} -> 2*RankFilter(IsMultiplicativeElementWithInverse),
function ( G, d, e, act )
local rep, # representative, result
S, # stabilizer of <G>
Expand Down Expand Up @@ -1516,7 +1516,7 @@ InstallOtherMethod( StabilizerOp, "permutation group with generators list",
IsList,
IsFunction ],
# the objects might be a group element: rank up
RankFilter(IsMultiplicativeElementWithInverse)
{} -> RankFilter(IsMultiplicativeElementWithInverse)
# and we are better even if the group is solvable
+RankFilter(IsSolvableGroup),
PermGroupStabilizerOp);
Expand All @@ -1528,7 +1528,7 @@ InstallOtherMethod( StabilizerOp, "permutation group with domain",true,
IsList,
IsFunction ],
# the objects might be a group element: rank up
RankFilter(IsMultiplicativeElementWithInverse)
{} -> RankFilter(IsMultiplicativeElementWithInverse)
# and we are better even if the group is solvable
+RankFilter(IsSolvableGroup),
PermGroupStabilizerOp);
Expand Down
Loading

0 comments on commit 6a81396

Please sign in to comment.