From 685cabdd4d9264c959bedde818db2122e446448b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 27 Jul 2023 13:21:41 +0200 Subject: [PATCH] Unify tests for quadratic field sizes ... and some related cleanup --- lib/correlations.gi | 2 +- lib/enumerators.gi | 6 +++--- lib/gpolygons.gi | 2 +- lib/group.gi | 2 +- lib/polaritiesps.gi | 2 +- lib/polarspace.gi | 6 +++--- lib/projectivespace.gi | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/correlations.gi b/lib/correlations.gi index 8294b370..bc0bd9f7 100644 --- a/lib/correlations.gi +++ b/lib/correlations.gi @@ -1648,7 +1648,7 @@ InstallMethod(HermitianPolarityOfProjectiveSpace, if Rank(matrix) <> NrRows(matrix) then Error(" must not be singular"); fi; - if not IsInt(Sqrt(Size(field))) then + if IsOddInt(DegreeOverPrimeField(field)) then Error("Size of must be a square" ); fi; form := HermitianFormByMatrix(matrix,field); diff --git a/lib/enumerators.gi b/lib/enumerators.gi index bc6dbe36..4dae505d 100644 --- a/lib/enumerators.gi +++ b/lib/enumerators.gi @@ -1580,7 +1580,7 @@ InstallGlobalFunction( HermElementNumber, a2 := a - 1; v := ListWithIdenticalEntries(d+1,Z(q)^0); n := Int((d+1) / 2); - FG_herm_Sbar_unrank(RootInt(q,2),v,1,d+1,a2); + FG_herm_Sbar_unrank(Sqrt(q),v,1,d+1,a2); return v; end ); @@ -1594,11 +1594,11 @@ InstallGlobalFunction( HermNumberElement, v := StructuralCopy(var!.obj); y := v[PositionNonZeroFromRight(v)]; if IsOddInt(q) then - y := y/(Z(q)^((RootInt(q,2)-1)/2)); #Strange Anton normalization... + y := y/(Z(q)^((Sqrt(q)-1)/2)); #Strange Anton normalization... fi; v := v/y; #wittindex := (d+1)/2; - a := FG_herm_Sbar_rank(RootInt(q,2), v, 1, d+1); + a := FG_herm_Sbar_rank(Sqrt(q), v, 1, d+1); return a + 1; ## adjustment for lists beginning at 1 end ); diff --git a/lib/gpolygons.gi b/lib/gpolygons.gi index 6707f324..84dd7c75 100644 --- a/lib/gpolygons.gi +++ b/lib/gpolygons.gi @@ -3577,7 +3577,7 @@ InstallMethod( FisherqClan, nonsquares := Difference(AsList(GF(q)),squares);; n := First(nonsquares, t -> t-1 in squares); - zeta := PrimitiveRoot(GF(q^2)); + zeta := Z(q^2); omega := zeta^(q+1); i := zeta^((q+1)/2); z := zeta^(q-1); diff --git a/lib/group.gi b/lib/group.gi index 098d25c1..1202213d 100644 --- a/lib/group.gi +++ b/lib/group.gi @@ -2379,7 +2379,7 @@ InstallMethod( CanonicalGramMatrix, # Unitary Gram matrix elif type = "hermitian" then - if IsOddInt(PrimePowersInt(Size(f))[2]) then + if IsOddInt(DegreeOverPrimeField(f)) then Error("field order must be a square"); fi; m := IdentityMat(d, f); diff --git a/lib/polaritiesps.gi b/lib/polaritiesps.gi index 733f14f6..9ea29c4e 100644 --- a/lib/polaritiesps.gi +++ b/lib/polaritiesps.gi @@ -151,7 +151,7 @@ InstallMethod(HermitianPolarityOfProjectiveSpace, if Rank(matrix) <> NrRows(matrix) then Error(" must not be singular"); fi; - if not IsInt(Sqrt(Size(field))) then + if IsOddInt(DegreeOverPrimeField(field)) then Error("Size of must be a square" ); fi; form := HermitianFormByMatrix(matrix,field); diff --git a/lib/polarspace.gi b/lib/polarspace.gi index d507ac65..1a0c13d7 100644 --- a/lib/polarspace.gi +++ b/lib/polarspace.gi @@ -763,7 +763,7 @@ InstallMethod( HermitianPolarSpace, [ IsPosInt, IsField ], function( d, f ) local h,m,types,max,reps,q,creps,degree; - if PrimePowersInt(Size(f))[2] mod 2 <> 0 then + if IsOddInt(DegreeOverPrimeField(f)) then Error("field order must be a square"); return; fi; @@ -2141,9 +2141,9 @@ InstallMethod( NumberOfTotallySingularSubspaces, elif type = "hyperbolic" then e:= 0; qe := q^e; elif type = "parabolic" or type = "symplectic" then e:=1; qe := q^e; elif type = "hermitian" and IsEvenInt(ps!.dimension) then e:=3; - qe := RootInt(q,2)^e; + qe := Sqrt(q)^e; elif type = "hermitian" and IsOddInt(ps!.dimension) then e:=1; - qe := RootInt(q,2)^e; + qe := Sqrt(q)^e; else Error("Polar space doesn't know its type!"); fi; diff --git a/lib/projectivespace.gi b/lib/projectivespace.gi index f81c4c85..a44cedc0 100644 --- a/lib/projectivespace.gi +++ b/lib/projectivespace.gi @@ -2225,7 +2225,7 @@ InstallMethod( BaerSublineOnThreePoints, fi; geo := AmbientSpace(x); gfq2 := geo!.basefield; - if RootInt(Size(gfq2),2)^2 <> Size(gfq2) then + if IsOddInt(DegreeOverPrimeField(gfq2)) then Error( "the order of the basefield must be a square" ); fi; gfq := GF(Sqrt(Size(gfq2)));