Creates the finite field GF(p^n) from a primitive polynomial
F = gf_create_field(p, n) F = gf_create_field(p, n, f)
Prime number: the characteristic of the field, at most 2^20.
Degree of the field over GF(p): an integer from 1 to 20, with p^n ≤ 2^20.
Primitive polynomial of degree n over GF(p): a row of n + 1 integer coefficients in 0 .. p-1, constant term first, with a non-zero last coefficient. It does not need to be monic. When it is omitted, the polynomial returned by gf_default_primitive_polynomial is used.
The field: list(p, n, f, elements).
F(1) is p and F(2) is n.
F(3) is the primitive polynomial (n + 1 coefficients, constant term first).
F(4) is the table of all the elements. For n = 1 it is the row 0:p-1. For n > 1 it is a p^n × n matrix: row 1 is the zero element and row k + 2 is α^k, α being a root of f.
gf_create_field builds the field of order p^n used by the other functions of the toolbox.
The polynomial f must be primitive, not only irreducible: its roots must generate the multiplicative group of the field, so that every non-zero element is a power of α. gf_is_primitive_polynomial tests this, and gf_primitive_polynomials lists all the monic primitive polynomials of a given degree. An error is raised when f is not primitive.
For n = 1, f has degree 1 and its root -f(1)/f(2) is a primitive root modulo p.
The element table is computed once, when the field is created. It has p^n rows of n doubles.
| Version | Description |
| 2.0.0 | Refactoring of the function/toolbox. A default primitive polynomial is now used for any n (it was only available for n = 1). Invalid arguments raise errors. |