Skip to content

Commit 9628fc7

Browse files
authored
Make various operations for rational matrix groups faster (fixes a performance regression from GAP 4.15.0) (#6138)
This fixes a performance regression from GAP 4.15.0 and in some cases makes things actually faster than they were then.
1 parent 3c74ccd commit 9628fc7

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

lib/ctblfuns.gd

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,10 +1343,8 @@ DeclareOperation( "Norm", [ IsOrdinaryTable, IsHomogeneousList ] );
13431343
## by listing the positions of conjugacy classes in the centre.)
13441344
## <P/>
13451345
## <Example><![CDATA[
1346-
## gap> List( Irr( S4 ), CentreOfCharacter );
1347-
## [ Group([ (), (1,2), (1,2)(3,4), (1,2,3), (1,2,3,4) ]), Group(()),
1348-
## Group([ (1,2)(3,4), (1,3)(2,4) ]), Group(()),
1349-
## Group([ (), (1,2), (1,2)(3,4), (1,2,3), (1,2,3,4) ]) ]
1346+
## gap> List( Irr( S4 ), chi -> StructureDescription(CentreOfCharacter(chi)) );
1347+
## [ "S4", "1", "C2 x C2", "1", "S4" ]
13501348
## ]]></Example>
13511349
## </Description>
13521350
## </ManSection>
@@ -1504,9 +1502,8 @@ DeclareOperation( "InertiaSubgroup",
15041502
## affords <A>chi</A>.
15051503
## <P/>
15061504
## <Example><![CDATA[
1507-
## gap> List( Irr( S4 ), KernelOfCharacter );
1508-
## [ Alt( [ 1 .. 4 ] ), Group(()), Group([ (1,2)(3,4), (1,3)(2,4) ]),
1509-
## Group(()), Group([ (), (1,2), (1,2)(3,4), (1,2,3), (1,2,3,4) ]) ]
1505+
## gap> List( Irr( S4 ), chi -> StructureDescription(KernelOfCharacter(chi)) );
1506+
## [ "A4", "1", "C2 x C2", "1", "S4" ]
15101507
## ]]></Example>
15111508
## </Description>
15121509
## </ManSection>

lib/grpramat.gi

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ InstallMethod( IsFinite,
266266
[ IsCyclotomicMatrixGroup ],
267267
function( G )
268268
# The code below is based on the algorithm described in [DFO13]
269-
local badPrimes, n, g, FindPrimesInMatDenominators, p, e, H, phi, gens, rels, nice;
269+
local badPrimes, n, g, FindPrimesInMatDenominators, p, e, H, phi, gens, rels, nice, inv, Hnice;
270270

271271
# if not rational, use the nice monomorphism into a rational matrix group
272272
if not IsRationalMatrixGroup( G ) then
@@ -309,28 +309,34 @@ function( G )
309309
return false;
310310
fi;
311311

312+
Hnice := NiceMonomorphism(H);
313+
H := NiceObject(H);
314+
312315
# evaluate relators
313-
phi := IsomorphismFpGroupByGenerators(H, GeneratorsOfGroup( H ));
316+
phi := IsomorphismFpGroupByGeneratorsNC(H, GeneratorsOfGroup( H ) : method := "fast");
314317

315318
gens := GeneratorsOfGroup(FreeGroupOfFpGroup(Range(phi)));
316319
rels := RelatorsOfFpGroup(Range(phi));
317320
if not ForAll(rels, r -> IsOne(MappedWord(r, gens, GeneratorsOfGroup(G)))) then
318321
return false;
319322
fi;
320323

324+
# bypass the finite field matrix group in the middle so that we can
325+
# compute preimages more easily
326+
inv := GroupHomomorphismByImagesNC(H, G : noassert);
327+
321328
# set as a nice monomorphism
322-
gens := GeneratorsOfGroup(Range(phi));
323329
nice := GroupHomomorphismByFunction(G, H,
324330
function(x)
325331
if ValueOption("actioncanfail")=true then
326332
if not ForAll( x, r -> ForAll( r, v -> IsRat(v) and DenominatorRat( v ) mod p <> 0 ) ) then
327333
return fail;
328334
fi;
329335
fi;
330-
return x * e;
336+
return Hnice(x * e);
331337
end,
332338
function(y)
333-
return MappedWord(phi(y), gens, GeneratorsOfGroup(G));
339+
return inv(y);
334340
end
335341
);
336342
SetNiceMonomorphism(G, nice);

0 commit comments

Comments
 (0)