Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DegreeOverPrimeField to simplify some code #37

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions lib/forms.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1185,29 +1185,25 @@
InstallOtherMethod( \^, "for a pair of FFE vectors and an hermitian form",
[ IsVectorList and IsFFECollColl, IsHermitianForm ],
function( pair, f )
local frob,hh,bf,p;
local frob,hh,bf;
if Size(pair) <> 2 then
Error("The first argument must be a pair of vectors");
fi;
bf := f!.basefield;
p := Characteristic(bf);
hh := LogInt(Size(bf),p)/2;
#frob := FrobeniusAutomorphism(f!.basefield); #here was a mistake!
hh := DegreeOverPrimeField(bf) / 2;
frob := FrobeniusAutomorphism(bf)^hh;
return pair[1] * f!.matrix * (pair[2]^frob);
end );

InstallOtherMethod( \^, "for a pair of FFE matrices and an hermitian form",
[ IsFFECollCollColl, IsHermitianForm ],
function( pair, f )
local frob,hh,bf,p;
local frob,hh,bf;
if Size(pair) <> 2 then
Error("The first argument must be a pair of vectors");
fi;
bf := f!.basefield;
p := Characteristic(bf);
hh := LogInt(Size(bf),p)/2;
#frob := FrobeniusAutomorphism(f!.basefield); #here was a mistake, noticed by using fining.
hh := DegreeOverPrimeField(bf) / 2;

Check warning on line 1206 in lib/forms.gi

View check run for this annotation

Codecov / codecov/patch

lib/forms.gi#L1206

Added line #L1206 was not covered by tests
frob := FrobeniusAutomorphism(bf)^hh;
return pair[1] * f!.matrix * (TransposedMat(pair[2])^frob);
end );
Expand Down Expand Up @@ -2944,18 +2940,13 @@
return v*f!.matrix*TransposedMat(w);
end );

# jdb 20/01/2016: here was a bug, there is no method for w^t, w a GF(q) vector
# t just a natural number! Bugfix: look at the method for \^
InstallMethod( EvaluateForm, "for an hermitian form and a pair of vectors",
[IsHermitianForm and IsFormRep,
IsVector and IsFFECollection, IsVector and IsFFECollection],
function(f,v,w)
local gf,t,p,hh,frob;
#t := Sqrt(Size(gf));
#return v*f!.matrix*(w^t); # here was the mistake.
local gf,t,hh,frob;
gf := f!.basefield;
p := Characteristic(gf);
hh := LogInt(Size(gf),p)/2;
hh := DegreeOverPrimeField(gf) / 2;
frob := FrobeniusAutomorphism(gf)^hh;
return v*f!.matrix*(w^frob);
end );
Expand All @@ -2967,7 +2958,7 @@
gf := f!.basefield;
t := Sqrt(Size(gf));
wCONJ := MutableTransposedMat(w);
m := Size(wCONJ); n := Size(wCONJ[1]);
m := NrRows(wCONJ); n := NrCols(wCONJ);
for i in [1..m] do
for j in [1..n] do
wCONJ[i,j] := wCONJ[i,j]^t;
Expand Down
6 changes: 3 additions & 3 deletions lib/recognition.gi
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ InstallGlobalFunction( ClassicalForms_ScalarMultipleFrobenius,

I := Filtered( [0 .. d], x -> not IsZero(c[x+1]) );
q := Size(F);
qq := Characteristic(F)^(LogInt(q,Characteristic(F))/2);
qq := Characteristic(F)^(DegreeOverPrimeField(F)/2);

Minv := M^-1;
tM := Trace(M); tMi := Trace(Minv)^qq; # Frobenius of trace
Expand Down Expand Up @@ -530,7 +530,7 @@ local F, k, dim, mats, dmats, qq, i, j, l;
return GModuleByMats([],module.dimension,SMTX.Field(module));
else
F := MTX.Field(module);
k := LogInt( Size(F), Characteristic(F) );
k := DegreeOverPrimeField(F);
if k mod 2 = 1 then
Error( "field <F> is not a square" );
fi;
Expand Down Expand Up @@ -570,7 +570,7 @@ ClassicalForms_InvariantFormFrobenius := function( module, fmodule )
field := MTX.Field(module);
form := hom[1];
q := Size(field);
qq := Characteristic(field)^(LogInt(q,Characteristic(field))/2);
qq := Characteristic(field)^(DegreeOverPrimeField(field)/2);
k := PositionNonZero(form[1]);
a := form[1,k] / form[k,1]^qq;
a := NthRoot(field,a,(1-qq) mod (q-1));
Expand Down