TESTS:
Test backwards compatibility:
sage: from sage.rings.finite_rings.finite_field_ntl_gf2e import FiniteField_ntl_gf2e
sage: FiniteField_ntl_gf2e(16, 'a')
doctest:...: DeprecationWarning: constructing a FiniteField_ntl_gf2e without giving a polynomial as modulus is deprecated, use the more general FiniteField constructor instead
See http://trac.sagemath.org/16983 for details.
Finite Field in a of size 2^4
Bases: sage.rings.finite_rings.finite_field_base.FiniteField
Finite Field of characteristic 2 and order .
INPUT:
q – (must be 2 power)
names – variable used for poly_repr (default: 'a')
modulus – A minimal polynomial to use for reduction.
(default: 'poly')
OUTPUT:
Finite field with characteristic 2 and cardinality .
EXAMPLES:
sage: k.<a> = GF(2^16)
sage: type(k)
<class 'sage.rings.finite_rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e_with_category'>
sage: k.<a> = GF(2^1024)
sage: k.modulus()
x^1024 + x^19 + x^6 + x + 1
sage: set_random_seed(0)
sage: k.<a> = GF(2^17, modulus='random')
sage: k.modulus()
x^17 + x^16 + x^15 + x^10 + x^8 + x^6 + x^4 + x^3 + x^2 + x + 1
sage: k.modulus().is_irreducible()
True
sage: k.<a> = GF(2^211, modulus='minimal_weight')
sage: k.modulus()
x^211 + x^11 + x^10 + x^8 + 1
sage: k.<a> = GF(2^211, modulus='conway')
sage: k.modulus()
x^211 + x^9 + x^6 + x^5 + x^3 + x + 1
sage: k.<a> = GF(2^23, modulus='conway')
sage: a.multiplicative_order() == k.order() - 1
True
Return the characteristic of self which is 2.
EXAMPLES:
sage: k.<a> = GF(2^16,modulus='random')
sage: k.characteristic()
2
If this field has cardinality this method returns
.
EXAMPLES:
sage: k.<a> = GF(2^64)
sage: k.degree()
64
Given an integer less than cardinality() with base
representation
, returns
, where
is the
generator of this finite field.
INPUT:
EXAMPLES:
sage: k.<a> = GF(2^48)
sage: k.fetch_int(2^43 + 2^15 + 1)
a^43 + a^15 + 1
sage: k.fetch_int(33793)
a^15 + a^10 + 1
sage: 33793.digits(2) # little endian
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
Return a generator of self over its prime field, which is a root of self.modulus().
INPUT:
OUTPUT:
An element of self such that self.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 the modulus="primitive" option when constructing the field.
EXAMPLES:
sage: k.<a> = GF(2^19)
sage: k.gen() == a
True
sage: a
a
TESTS:
sage: GF(2, impl='ntl').gen()
1
sage: GF(2, impl='ntl', modulus=polygen(GF(2)) ).gen()
0
sage: GF(2^19, 'a').gen(1)
Traceback (most recent call last):
...
IndexError: only one generator
Return the cardinality of this field.
EXAMPLES:
sage: k.<a> = GF(2^64)
sage: k.order()
18446744073709551616
Return the prime subfield of self if self is
.
EXAMPLES:
sage: F.<a> = GF(2^16)
sage: F.prime_subfield()
Finite Field of size 2
Imports various modules after startup.
EXAMPLES:
sage: sage.rings.finite_rings.finite_field_ntl_gf2e.late_import()
sage: sage.rings.finite_rings.finite_field_ntl_gf2e.GF2 is None # indirect doctest
False