From cee8c18f06e861974206c682e537902d1e59acc7 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 18 Jan 2017 20:05:14 +0100 Subject: [PATCH] grp: fix regressions with matrix group constructors This partially reverts commit 38c80a9e3eba19dd490e525be6f412699c8959cb. Also add some comments and tests. --- grp/basic.gd | 14 ++++++-------- tst/testinstall/grp/basic.tst | 10 ++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/grp/basic.gd b/grp/basic.gd index d018fae766..be3dc46f11 100644 --- a/grp/basic.gd +++ b/grp/basic.gd @@ -135,7 +135,6 @@ BindGlobal( "AbelianGroup", function ( arg ) fi; return AbelianGroupCons( IsPcGroup, arg[1] ); elif IsOperation(arg[1]) then - if Length(arg) = 2 then return AbelianGroupCons( arg[1], arg[2] ); fi; @@ -257,9 +256,11 @@ BindGlobal( "CyclicGroup", function ( arg ) fi; return CyclicGroupCons( IsPcGroup, arg[1] ); elif IsOperation(arg[1]) then - if Length(arg) = 2 then return CyclicGroupCons( arg[1], arg[2] ); + elif Length(arg) = 3 then + # some filters require extra arguments, e.g. IsMatrixGroup + field + return CyclicGroupCons( arg[1], arg[2], arg[3] ); fi; fi; Error( "usage: CyclicGroup( [, ] )" ); @@ -311,7 +312,6 @@ BindGlobal( "DihedralGroup", function ( arg ) if Length(arg) = 1 then return DihedralGroupCons( IsPcGroup, arg[1] ); elif IsOperation(arg[1]) then - if Length(arg) = 2 then return DihedralGroupCons( arg[1], arg[2] ); fi; @@ -368,9 +368,11 @@ BindGlobal( "QuaternionGroup", function ( arg ) if Length(arg) = 1 then return QuaternionGroupCons( IsPcGroup, arg[1] ); elif IsOperation(arg[1]) then - if Length(arg) = 2 then return QuaternionGroupCons( arg[1], arg[2] ); + elif Length(arg) = 3 then + # some filters require extra arguments, e.g. IsMatrixGroup + field + return QuaternionGroupCons( arg[1], arg[2], arg[3] ); fi; fi; Error( "usage: QuaternionGroup( [, ] )" ); @@ -422,7 +424,6 @@ BindGlobal( "ElementaryAbelianGroup", function ( arg ) if Length(arg) = 1 then return ElementaryAbelianGroupCons( IsPcGroup, arg[1] ); elif IsOperation(arg[1]) then - if Length(arg) = 2 then return ElementaryAbelianGroupCons( arg[1], arg[2] ); fi; @@ -474,7 +475,6 @@ BindGlobal( "FreeAbelianGroup", function ( arg ) if Length(arg) = 1 then return FreeAbelianGroupCons( IsFpGroup, arg[1] ); elif IsOperation(arg[1]) then - if Length(arg) = 2 then return FreeAbelianGroupCons( arg[1], arg[2] ); fi; @@ -539,7 +539,6 @@ BindGlobal( "ExtraspecialGroup", function ( arg ) if Length(arg) = 2 then return ExtraspecialGroupCons( IsPcGroup, arg[1], arg[2] ); elif IsOperation(arg[1]) then - if Length(arg) = 3 then return ExtraspecialGroupCons( arg[1], arg[2], arg[3] ); fi; @@ -592,7 +591,6 @@ BindGlobal( "MathieuGroup", function( arg ) if Length( arg ) = 1 then return MathieuGroupCons( IsPermGroup, arg[1] ); elif IsOperation( arg[1] ) then - if Length( arg ) = 2 then return MathieuGroupCons( arg[1], arg[2] ); fi; diff --git a/tst/testinstall/grp/basic.tst b/tst/testinstall/grp/basic.tst index 67b52e490b..8b151409fd 100644 --- a/tst/testinstall/grp/basic.tst +++ b/tst/testinstall/grp/basic.tst @@ -74,6 +74,11 @@ gap> CyclicGroup(IsPermGroup,4); Group([ (1,2,3,4) ]) gap> CyclicGroup(IsFpGroup,4); +gap> G:=CyclicGroup(IsMatrixGroup, GF(2), 12); + +gap> FieldOfMatrixGroup(G); DimensionOfMatrixGroup(G); +GF(2) +12 # gap> CyclicGroup(2,3); @@ -112,6 +117,11 @@ gap> QuaternionGroup(IsPermGroup,8); Group([ (1,5,3,7)(2,8,4,6), (1,2,3,4)(5,6,7,8) ]) gap> QuaternionGroup(IsFpGroup,8); +gap> G:=QuaternionGroup(IsMatrixGroup, GF(3), 8); + +gap> FieldOfMatrixGroup(G); DimensionOfMatrixGroup(G); +GF(3) +4 # gap> QuaternionGroup(2,3);