Skip to content

Commit

Permalink
CLEANUP: Replace calls to FactInt with Factors(Integers,
Browse files Browse the repository at this point in the history
This way better factorizations methods in packages will get used.
(Calls in the recursive implementation of FactInt are kept.)
Also replace some calls by `PrimePGroup` etc.

(This is a revised version of earlier as there was already a merge with
PrimePGroup.)

This addresses gap-system#2087
  • Loading branch information
hulpke committed Feb 8, 2018
1 parent 22ec553 commit 9783ee9
Show file tree
Hide file tree
Showing 26 changed files with 66 additions and 66 deletions.
4 changes: 2 additions & 2 deletions lib/claspcgs.gi
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ local G, home, # the group and the home pcgs
cent:=false;

elif IsPrimePowerInt(Size(G)) then
p:=FactorsInt(Size(G))[1];
p:=PrimePGroup(G);
home:=PcgsPCentralSeriesPGroup(G);
eas:=PCentralNormalSeriesByPcgsPGroup(home);

Expand Down Expand Up @@ -1107,7 +1107,7 @@ local G, home, # the group and the home pcgs
(InducedPcgs(home,cl.centralizer), c -> Comm(k, c) in L));
end;
elif IsPrimePowerInt(Size(G)) then
p:=FactorsInt(Size(G))[1];
p:=PrimePGroup(G);
home:=PcgsPCentralSeriesPGroup(G);
eas:=PCentralNormalSeriesByPcgsPGroup(home);

Expand Down
10 changes: 5 additions & 5 deletions lib/ctbl.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ InstallGlobalFunction( CharacterTable_IsNilpotentNormalSubgroup,
orders:= OrdersClassRepresentatives( tbl );
ppow:= Filtered( N, i -> IsPrimePowerInt( orders[i] ) );

for part in Collected( FactorsInt( Sum( classlengths{ N }, 0 ) ) ) do
for part in Collected( Factors(Integers, Sum( classlengths{ N }, 0 ) ) ) do

# Check whether the Sylow p subgroup of `N' is normal in `N',
# i.e., whether the number of elements of p-power is equal to
Expand Down Expand Up @@ -2903,7 +2903,7 @@ InstallMethod( PrimeBlocksOp,
if d = ppart then
d:= 0;
else
d:= Length( FactorsInt( ppart / d ) ); # the defect
d:= Length( Factors(Integers, ppart / d ) ); # the defect
fi;
Add( primeblocks.defect, d );

Expand Down Expand Up @@ -4923,7 +4923,7 @@ BindGlobal( "CharacterTableDisplayDefault", function( tbl, options )
elif centralizers = true then
Print( "\n" );
for i in [col..col+acol-1] do
fak:= FactorsInt( tbl_centralizers[classes[i]] );
fak:= Factors(Integers, tbl_centralizers[classes[i]] );
for prime in Set( fak ) do
cen[prime][i]:= Number( fak, x -> x = prime );
od;
Expand Down Expand Up @@ -5279,8 +5279,8 @@ InstallMethod( CharacterTableDirectProduct,

# Compute power maps for all prime divisors of the result order.
vals_direct:= ComputedPowerMaps( direct );
for k in Union( FactorsInt( Size( tbl1 ) ),
FactorsInt( Size( tbl2 ) ) ) do
for k in Union( Factors(Integers, Size( tbl1 ) ),
Factors(Integers, Size( tbl2 ) ) ) do
powermap_k:= [];
vals1:= PowerMap( tbl1, k );
vals2:= PowerMap( tbl2, k );
Expand Down
4 changes: 2 additions & 2 deletions lib/ctblfuns.gi
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ InstallMethod( CorrespondingPermutations,
# Note that if we have taken away a union of orbits such that the
# number of remaining points is smaller than the smallest prime
# divisor of the order of `g' then all these points must be fixed.
min:= FactorsInt( Order( g ) )[1];
min:= Factors(Integers, Order( g ) )[1];
images:= [];

for list in part do
Expand Down Expand Up @@ -942,7 +942,7 @@ InstallOtherMethod( CorrespondingPermutations,
# Note that if we have taken away a union of orbits such that the
# number of remaining points is smaller than the smallest prime
# divisor of the order of `g' then all these points must be fixed.
min:= FactorsInt( Order( g ) )[1];
min:= Factors(Integers, Order( g ) )[1];
images:= [];

for list in part do
Expand Down
4 changes: 2 additions & 2 deletions lib/ctblmaps.gi
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ InstallOtherMethod( PowerMapOp,
fi;

image:= class;
for i in FactorsInt( n ) do
for i in Factors(Integers, n ) do
# Here we use that `n' is a small integer.
if not IsBound( powermap[i] ) then

Expand Down Expand Up @@ -3368,7 +3368,7 @@ InstallGlobalFunction( ConsiderSmallerPowerMaps, function( arg )

for i in omega do

factors:= FactorsInt( prime mod tbl_orders[i] );
factors:= Factors(Integers, prime mod tbl_orders[i] );
if factors = [ 1 ] or factors = [ 0 ] then factors:= []; fi;

if ForAll( Set( factors ), x -> IsBound( tbl_powermap[x] ) ) then
Expand Down
6 changes: 3 additions & 3 deletions lib/ctblmono.gi
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ InstallMethod( IsMonomialNumber,
pair2, # loop over `collect'
ord; # multiplicative order

factors := FactorsInt( n );
factors := Factors(Integers, n );
collect := Collected( factors );

# Get $\nu_2(n)$.
Expand Down Expand Up @@ -1120,7 +1120,7 @@ InstallMethod( TestMonomialQuick,
if IsSolvableGroup( G ) then

pi := PrimeDivisors( codegree );
hall := Product( Filtered( FactorsInt( factsize ), x -> x in pi ), 1 );
hall := Product( Filtered( Factors(Integers, factsize ), x -> x in pi ), 1 );

if factsize / hall = chi[1] then

Expand Down Expand Up @@ -1967,7 +1967,7 @@ InstallMethod( IsMinimalNonmonomial,
factsize:= Index( K, F );

# The Fitting subgroup of a minimal nomonomial group is a $p$-group.
facts:= FactorsInt( Size( F ) );
facts:= Factors(Integers, Size( F ) );
p:= Set( facts );
if 1 < Length( p ) then
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/ctblpope.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@ InstallGlobalFunction( PermCandidatesFaithful,
od;
# `primes': prime divisors of $|U|$ for which there is only one $G$-family
# of that element order in $UN$:
factors:= FactorsInt( tbl_size / torso[1] );
factors:= Factors(Integers, tbl_size / torso[1] );
primes:= Set( factors );
orbits:= List( primes, p -> [] );
for i in [ 1 .. nccl ] do
Expand Down
4 changes: 2 additions & 2 deletions lib/cyclotom.gi
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ InstallGlobalFunction( CoeffsCyc, function( z, N )
# must be equal, and the negative of this value is put at the
# position of the $p$-th element of this congruence class.
if second > 1 then
for p in FactorsInt( second ) do
for p in Factors(Integers, second ) do
nn:= n / p;
newcoeffs:= ListWithIdenticalEntries( nn, 0 );
for k in [ 1 .. n ] do
Expand Down Expand Up @@ -1245,7 +1245,7 @@ InstallGlobalFunction( Quadratic, function( arg )
fi;

coeffs:= ExtRepOfObj( cyc );
facts:= FactorsInt( Length( coeffs ) );
facts:= Factors(Integers, Length( coeffs ) );
factsset:= Set( facts );
two_part:= Number( facts, x -> x = 2 );

Expand Down
2 changes: 1 addition & 1 deletion lib/ffe.gi
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ InstallMethod( Order,
p := Characteristic(z);
d := DegreeFFE(z);
ord := p^d-1;
facs := Collected(FactorsInt(ord));
facs := Collected(Factors(Integers,ord));
for f in facs do
for i in [1..f[2]] do
o := ord/f[1];
Expand Down
6 changes: 3 additions & 3 deletions lib/ffeconway.gi
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ FFECONWAY.WriteOverSmallestField := function(x)
return x![3];
fi;
d := x![2];
f := Collected(FactorsInt(d));
f := Collected(Factors(Integers,d));
for fac in f do
l := fac[1];
d1 := d/l;
Expand Down Expand Up @@ -1355,7 +1355,7 @@ FFECONWAY.DoLogFFE :=
fi;

# use rho method
f:=FactorsInt(q-1:quiet); # Quick factorization, don't stop if its too hard
f:=Factors(Integers,q-1:quiet); # Quick factorization, don't stop if its too hard
return FFECONWAY.DoLogFFERho(y,z,q-1,f,q);
end;

Expand Down Expand Up @@ -1392,7 +1392,7 @@ InstallMethod( Order,
p := Characteristic(z);
d := DegreeFFE(z);
ord := p^d-1;
facs := Collected(FactorsInt(ord));
facs := Collected(Factors(Integers,ord));
for f in facs do
for i in [1..f[2]] do
o := ord/f[1];
Expand Down
6 changes: 3 additions & 3 deletions lib/fldabnum.gi
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ InstallGlobalFunction( ZumbroichBase, function( n, m )
Error( "<m> must be a divisor of <n>" );
fi;

factsn:= FactorsInt( n );
factsn:= Factors(Integers, n );
primes:= Set( factsn );
exponsn:= List( primes, x -> 0 ); # Product(List( [1..Length(primes)],
# x->primes[i]^exponsn[i]))=n
Expand All @@ -837,7 +837,7 @@ InstallGlobalFunction( ZumbroichBase, function( n, m )
exponsn[ pos ]:= exponsn[ pos ] + 1;
od;

factsm:= FactorsInt( m );
factsm:= Factors(Integers, m );
exponsm:= List( primes, x -> 0 ); # Product(List( [1..Length(primes)],
# x->primes[i]^exponsm[i]))=m
if m <> 1 then
Expand Down Expand Up @@ -960,7 +960,7 @@ InstallGlobalFunction( LenstraBase, function( n, stabilizer, supergroup, m )
m:= m / 2;
fi;

factors := FactorsInt( n );
factors := Factors(Integers, n );
primes := Set( factors );
coprimes := Filtered( primes, x -> m mod x <> 0 );
nprime := Product( Filtered( factors, x -> m mod x <> 0 ) );
Expand Down
12 changes: 6 additions & 6 deletions lib/grp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ InstallMethod( AbelianInvariants,
G := H;
gns := GeneratorsOfGroup( G );
if r <> 1 then
Add( ranks, Length(FactorsInt(r)) );
Add( ranks, Length(Factors(Integers,r)) );
fi;
until r = 1;
Info( InfoGroup, 2,
Expand Down Expand Up @@ -1625,7 +1625,7 @@ InstallGlobalFunction( SupersolvableResiduumDefault, function( G )
# `df' is the commutator factor group `oldssr / ssr'.
df:= Range( dh );
SetIsAbelian( df, true );
fs:= FactorsInt( Size( df ) );
fs:= Factors(Integers, Size( df ) );

# `gen' collects the generators for the next candidate
gen := ShallowCopy( GeneratorsOfGroup( df ) );
Expand Down Expand Up @@ -3656,8 +3656,8 @@ IsomorphismTypeInfoFiniteSimpleGroup_fun:= function( G )
# from now on we deal with groups of Lie-type

# calculate the dominant prime of size
q := Maximum( List( Collected( FactorsInt( size ) ), s -> s[1]^s[2] ) );
p := FactorsInt( q )[1];
q := Maximum( List( Collected( Factors(Integers, size ) ), s -> s[1]^s[2] ) );
p := Factors(Integers, q )[1];

# test if <G> is the Chevalley group A(1,7) ~ A(2,2)
if size = 168 then
Expand Down Expand Up @@ -4583,7 +4583,7 @@ function( g )
if o = 1 then return []; fi;

# start to split
f := FactorsInt( o );
f := Factors(Integers, o );
if Length( Set( f ) ) = 1 then
return [ g ];
else
Expand Down Expand Up @@ -4612,7 +4612,7 @@ function( g, p )
o := Order( g );
if o = 1 then return g; fi;

f := FactorsInt( o );
f := Factors(Integers, o );
x := Number( f, x -> x = p );
if x = 0 then return g^o; fi;

Expand Down
2 changes: 1 addition & 1 deletion lib/grpffmat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ end);
## PSL(n,q), SU(n,q) and PSU(n,q)
##
InstallGlobalFunction(Phi2,
n -> n^2 * Product(Set(Filtered(FactorsInt(n), m -> m <> 1)),
n -> n^2 * Product(Set(Filtered(Factors(Integers,n), m -> m <> 1)),
p -> (1 - 1/p^2)));

#############################################################################
Expand Down
6 changes: 3 additions & 3 deletions lib/grppcfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ gensA, relsA, gensG, imgs, prei, i, j, k, l, norm, index, diag, n,genu;

# compute pc presentation for the finite quotient
n := Filtered( diag, x -> x <> 1 );
n := Length( Flat( List( n, x -> FactorsInt( x ) ) ) );
n := Length( Flat( List( n, x -> Factors(Integers, x ) ) ) );
A := FreeGroup(IsSyllableWordsFamily, n );
gensA := GeneratorsOfGroup( A );

Expand All @@ -170,7 +170,7 @@ gensA, relsA, gensG, imgs, prei, i, j, k, l, norm, index, diag, n,genu;
for i in [ 1..ng ] do
if D[i][i] <> 1 then
index[i] := g;
pf[i] := TransposedMat( Collected( FactorsInt( D[i][i] ) ) );
pf[i] := TransposedMat( Collected( Factors(Integers, D[i][i] ) ) );
pf[i] := rec( factors := pf[i][1],
powers := pf[i][2] );
for j in [ 1..Length( pf[i].factors ) ] do
Expand Down Expand Up @@ -844,7 +844,7 @@ local G, epi, tup, lift, i, found, fac, j, p, iso;
i := primes / Size( G );
found := true;
while i > 1 and found do
fac := Collected( FactorsInt( i ) );
fac := Collected( Factors(Integers, i ) );
found := false;
j := 1;
while not found and j <= Length( fac ) do
Expand Down
4 changes: 2 additions & 2 deletions lib/grpperm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ InstallMethod( Socle,"for permgrp", true, [ IsPermGroup ], 0,
elif deg < 12960000 then
shortcut := true;
if deg >= 3125 then
coll := Collected( FactorsInt( deg ) );
coll := Collected( Factors(Integers, deg ) );
d := Gcd( List( coll, c -> c[ 2 ] ) );
if d mod 5 = 0 then
m := 1;
Expand All @@ -1560,7 +1560,7 @@ InstallMethod( Socle,"for permgrp", true, [ IsPermGroup ], 0,
fi;
fi;

coll := Collected( FactorsInt( Size( G ) ) );
coll := Collected( Factors(Integers, Size( G ) ) );
if deg < 78125 then
p := coll[ Length( coll ) ][ 1 ];
else
Expand Down
14 changes: 7 additions & 7 deletions lib/grpprmcs.gi
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ InstallGlobalFunction( NonPerfectCSPG,
i; # loop variables

# number of primes in factor <workgroup> / <derived subgroup>
listlength := Length(FactorsInt(top));
listlength := Length(Factors(Integers,top));
indexup := index+listlength;
oldworkup := D;

Expand All @@ -294,7 +294,7 @@ InstallGlobalFunction( NonPerfectCSPG,
x->(x^g in oldworkup) ));
workup := ClosureGroup(oldworkup, g);
order := Size(workup)/Size(oldworkup);
orderlist := FactorsInt(order);
orderlist := Factors(Integers,order);
for i in [1..Length(orderlist)] do

# h is the power of g which adds prime length factors
Expand Down Expand Up @@ -405,7 +405,7 @@ InstallGlobalFunction( PerfectCSPG,
OnTuples);
if IsTrivial(stab2) then

prime := FactorsInt(whichcase[2])[1];
prime := Factors(Integers,whichcase[2])[1];
N:=Group(One(K));
repeat
kerelement:=Random(K);
Expand All @@ -431,7 +431,7 @@ InstallGlobalFunction( PerfectCSPG,
L := Orbit( H, StabChainMutable( H ).orbit[1] );
tchom := ActionHomomorphism(H,L,"surjective");
op := Image( tchom );
H := PreImage(tchom,PCore(op,FactorsInt(whichcase[2])[1]));
H := PreImage(tchom,PCore(op,Factors(Integers,whichcase[2])[1]));
H := Centre(H);
SetIsAbelian( H, true );
fi;
Expand Down Expand Up @@ -519,7 +519,7 @@ InstallGlobalFunction( CasesCSPG, function(G)
fi;

# degree is not prime power
primes := FactorsInt(degree);
primes := Factors(Integers,degree);
if primes[1] < primes[Length(primes)] then
output[1] := 1;
# only case when index of primitive group in socle is not 2*prime
Expand Down Expand Up @@ -659,7 +659,7 @@ InstallGlobalFunction( FindRegularNormalCSPG, function ( G, H, whichcase )

# case of abelian normal subgroup
if whichcase[1] <> 2 then
core := PCore( H, FactorsInt(whichcase[2])[1] );
core := PCore( H, Factors(Integers, whichcase[2])[1] );
chain:=StabChainOp(core,rec(base:=BaseOfGroup(G),reduced:=false));
cosetrep := chain.transversal[chain.orbit[2]];
candidates := AsList(Stabilizer(core,BaseOfGroup(G)[1]))*cosetrep;
Expand Down Expand Up @@ -1670,7 +1670,7 @@ InstallMethod( RadicalGroup,
# subgroup; kernel is abelian normal.
# Take image at this action, and repeat
while index > 0 do
primes := FactorsInt(factorsize[index]);
primes := Factors(Integers,factorsize[index]);

# if the factor group is not cyclic, no chance for nontrivial radical
if Length(primes) > 1 then
Expand Down
2 changes: 1 addition & 1 deletion lib/integer.gi
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ InstallGlobalFunction(DivisorsInt,function ( n )
if n <= Length(DivisorsIntCache) then
return DivisorsIntCache[n];
fi;
factors := FactorsInt( n );
factors := Factors(Integers, n );

# recursive function to compute the divisors
divs := function ( i, m )
Expand Down
2 changes: 1 addition & 1 deletion lib/matrix.gi
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,7 @@ InstallGlobalFunction( NullspaceModQ, function( E, q )
j, i,k;

# factorize q
facs := FactorsInt( q );
facs := Factors(Integers, q );
p := facs[1];
n := Length( facs );
field := GF(p);
Expand Down
Loading

0 comments on commit 9783ee9

Please sign in to comment.