Finite fields implemented via PARI’s FFELT type#
AUTHORS:
Peter Bruin (June 2013): initial version, based on finite_field_ext_pari.py by William Stein et al.
- class sage.rings.finite_rings.finite_field_pari_ffelt.FiniteField_pari_ffelt(p, modulus, name=None)#
Bases:
sage.rings.finite_rings.finite_field_base.FiniteField
Finite fields whose cardinality is a prime power (not a prime), implemented using PARI’s
FFELT
type.INPUT:
p
– prime numbermodulus
– an irreducible polynomial of degree at least 2 over the field of \(p\) elementsname
– string: name of the distinguished generator (default: variable name ofmodulus
)
OUTPUT:
A finite field of order \(q = p^n\), generated by a distinguished element with minimal polynomial
modulus
. Elements are represented as polynomials inname
of degree less than \(n\).Note
Direct construction of
FiniteField_pari_ffelt
objects requires specifying a characteristic and a modulus. To construct a finite field by specifying a cardinality and an algorithm for finding an irreducible polynomial, use theFiniteField
constructor withimpl='pari_ffelt'
.EXAMPLES:
Some computations with a finite field of order 9:
sage: k = FiniteField(9, 'a', impl='pari_ffelt') sage: k Finite Field in a of size 3^2 sage: k.is_field() True sage: k.characteristic() 3 sage: a = k.gen() sage: a a sage: a.parent() Finite Field in a of size 3^2 sage: a.charpoly('x') x^2 + 2*x + 2 sage: [a^i for i in range(8)] [1, a, a + 1, 2*a + 1, 2, 2*a, 2*a + 2, a + 2] sage: TestSuite(k).run()
Next we compute with a finite field of order 16:
sage: k16 = FiniteField(16, 'b', impl='pari_ffelt') sage: z = k16.gen() sage: z b sage: z.charpoly('x') x^4 + x + 1 sage: k16.is_field() True sage: k16.characteristic() 2 sage: z.multiplicative_order() 15
Illustration of dumping and loading:
sage: K = FiniteField(7^10, 'b', impl='pari_ffelt') sage: loads(K.dumps()) == K True sage: K = FiniteField(10007^10, 'a', impl='pari_ffelt') sage: loads(K.dumps()) == K True
- characteristic()#
Return the characteristic of
self
.EXAMPLES:
sage: F = FiniteField(3^4, 'a', impl='pari_ffelt') sage: F.characteristic() 3
- degree()#
Returns the degree of
self
over its prime field.EXAMPLES:
sage: F = FiniteField(3^20, 'a', impl='pari_ffelt') sage: F.degree() 20
- gen(n=0)#
Return a generator of
self
over its prime field, which is a root ofself.modulus()
.INPUT:
n
– must be 0
OUTPUT:
An element \(a\) of
self
such thatself.modulus()(a) == 0
.Warning
This generator is not guaranteed to be a generator for the multiplicative group. To obtain the latter, use
multiplicative_generator()
or use themodulus="primitive"
option when constructing the field.EXAMPLES:
sage: R.<x> = PolynomialRing(GF(2)) sage: FiniteField(2^4, 'b', impl='pari_ffelt').gen() b sage: k = FiniteField(3^4, 'alpha', impl='pari_ffelt') sage: a = k.gen() sage: a alpha sage: a^4 alpha^3 + 1