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

Larger Finite Fields, take 2 #2997

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions doc/ref/fieldfin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ Finally note that elements of large prime fields are stored and
displayed as residue class objects. So
<P/>
<Example><![CDATA[
gap> Z(65537);
ZmodpZObj( 3, 65537 )
gap> Z(NextPrimeInt(2^30));
ZmodpZObj( 2, 1073741827 )
]]></Example>
</Description>
</ManSection>
Expand Down
9 changes: 7 additions & 2 deletions etc/ffgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
#include <stdlib.h>
#include <string.h>


#define MAX_FF 65536
/* These next lines control the size of internal finite field elements
in GAP. Changes here will propagate as needed */
#if (SIZEOF_VOID_P == 8)
#define MAX_FF (1 << 24)
#else
#define MAX_FF (1 << 16)
#endif

unsigned char is_prime[MAX_FF + 1];
unsigned char is_ff[MAX_FF + 1];
Expand Down
2 changes: 1 addition & 1 deletion etc/gen_conway.g
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ConwayPolForCCodeNice := function(p,h,align)
return Concatenation(substring);
end;

MAX := 2^16;
MAX := 2^24;
align := 4 + LogInt(MAX, 10);

polynomials_as_strings_of_numbers := [];
Expand Down
17 changes: 12 additions & 5 deletions lib/ffe.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
## <ManSection>
## <Func Name="Z" Arg='p^d' Label="for field size"/>
## <Func Name="Z" Arg='p, d' Label="for prime and degree"/>
## <Var Name="MAXSIZE_GF_INTERNAL"/>
##
## <Description>
## For creating elements of a finite field,
Expand All @@ -30,15 +31,20 @@
## <P/>
## &GAP; can represent elements of all finite fields
## <C>GF(<A>p^d</A>)</C> such that either
## (1) <A>p^d</A> <M>&lt;= 65536</M> (in which case an extremely efficient
## internal representation is used);
## (1) <A>p^d</A> <M>&lt;=</M> <C>MAXSIZE_GF_INTERNAL</C> (in which case an
## efficient internal representation is used);
## (2) d = 1, (in which case, for large <A>p</A>, the field is represented
## using the machinery of residue class rings
## (see section&nbsp;<Ref Sect="Residue Class Rings"/>) or
## (3) if the Conway polynomial of degree <A>d</A> over the field with
## <A>p</A> elements is known, or can be computed
## (see <Ref Func="ConwayPolynomial"/>).
## <P/>
##
## <C>MAXSIZE_GF_INTERNAL</C> may depend on the word size of your computer
## and the version of &GAP; but will typically be either <M>2^{16}</M> or
## <M>2^{24}</M>.<P/>
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
##
## If you attempt to construct an element of <C>GF(<A>p^d</A>)</C> for which
## <A>d</A> <M>> 1</M> and the relevant Conway polynomial is not known,
## and not necessarily easy to find
Expand Down Expand Up @@ -107,14 +113,15 @@
## 0*Z(2)
## gap> a*a;
## Z(2^5)^2
## gap> b := Z(3,12);
## gap> b := Z(3,20);
## z
## gap> b*b;
## z2
## gap> b+b;
## 2z
## gap> Print(b^100,"\n");
## Z(3)^0+Z(3,12)^5+Z(3,12)^6+2*Z(3,12)^8+Z(3,12)^10+Z(3,12)^11
## 2*Z(3,20)^2+Z(3,20)^4+Z(3,20)^6+Z(3,20)^7+2*Z(3,20)^9+2*Z(3,20)^10+2*Z\
## (3,20)^12+2*Z(3,20)^15+2*Z(3,20)^17+Z(3,20)^18+Z(3,20)^19
## ]]></Example>
## <Log><![CDATA[
## gap> Z(11,40);
Expand Down Expand Up @@ -270,7 +277,7 @@ DeclareCategoryCollections( "IsFFECollColl" );
## true
## gap> Z(256) > Z(101);
## false
## gap> Z(2,20) < Z(2,20)^2; # this illustrates the lexicographic ordering
## gap> Z(2,30) < Z(2,30)^2; # this illustrates the lexicographic ordering
## false
## ]]></Example>
## </Description>
Expand Down
Loading