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

Fix Coefficients for large finite fields created via a polynomial #4703

Merged
merged 1 commit into from
Nov 17, 2021
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
11 changes: 6 additions & 5 deletions lib/fieldfin.gi
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ InstallMethod( Basis,
InstallMethod( BasisNC,
"for a finite field, and a hom. list",
IsIdenticalObj,
[ IsField and IsFinite, IsHomogeneousList ], 10,
[ IsField and IsFinite, IsFFECollection and IsList ], 10,
function( F, gens )

local B, # the basis, result
Expand Down Expand Up @@ -581,13 +581,14 @@ InstallMethod( LinearCombination,
##
#M CanonicalBasis( <F> )
##
## The canonical basis of the finite field with $p^n$ elements, viewed over
## its subfield with $p^d$ elements, consists of the vectors `<z> ^ <i>',
## $0 \leq i \< n/d$, where <z> is the primitive root of <F>.
## The canonical basis of the finite field <F> with $p^n$ elements,
## viewed over its subfield with $p^d$ elements,
## consists of the vectors $<z>^i$, $0 \leq i \< n/d$,
## where <z> is `RootOfDefiningPolynomial( <F> )'.
##
InstallMethod( CanonicalBasis,
"for a finite field",
[ IsField and IsFinite ],
[ IsField and IsFinite and IsFFECollection ],
function( F )
local z, # primitive root
B; # basis record, result
Expand Down
33 changes: 32 additions & 1 deletion tst/testinstall/ffe.tst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@local Rochambeau,e,F,f1,f2,f3,p,pol,qs,r,x,bigPrime,z,odds,evens
#@local r1,r2,r3,sf1,sf2,sf3,q,q2
#@local r1,r2,r3,sf1,sf2,sf3,q,q2,Fp,fields,C,coeffs,B
gap> START_TEST("ffe.tst");

#
Expand Down Expand Up @@ -161,6 +161,37 @@ GF(1152921504606847009^2)
gap> Z(bigPrime,2) = PrimitiveElement(F);
true

#
# Check that `Coefficients` returns objects of the right type.
#
gap> p:= NextPrimeInt( 10^6 );;
gap> fields:= [ GF(3), GF(3^2), GF(p), LargeGaloisField( p, 2 ) ];;
gap> Fp:= LargeGaloisField( p );;
gap> pol:= UnivariatePolynomial( Fp, [ 912543, 810, 1 ] * One( Fp ) );;
gap> Add( fields, GF( Fp, pol ) );
gap> List( fields, IsFFECollection );
[ true, true, true, true, false ]
gap> List( fields, F -> IsSubset( F, LeftActingDomain( F ) ) );
[ true, true, true, true, false ]
gap> for F in fields do
> Fp:= LeftActingDomain( F );
> C:= CanonicalBasis( F );
> coeffs:= Coefficients( C, One( F ) );
> if not IsSubset( Fp, coeffs ) then
> Error( F );
> fi;
> B:= Basis( F, BasisVectors( C ) );
> coeffs:= Coefficients( B, One( F ) );
> if not IsSubset( Fp, coeffs ) then
> Error( F );
> fi;
> B:= BasisNC( F, BasisVectors( C ) );
> coeffs:= Coefficients( B, One( F ) );
> if not IsSubset( Fp, coeffs ) then
> Error( F );
> fi;
> od;

#
# comparing FFEs
#
Expand Down