FLINT3.7.0-dev

fq_default_ctx_init, fq_default_ctx_init_type

Synopsis#include <flint/fq_default.h>
void fq_default_ctx_init(fq_default_ctx_t ctx, const fmpz_t p, slong d, const char * var)source
void fq_default_ctx_init_type(fq_default_ctx_t ctx, const fmpz_t p, slong d, const char * var, int type)source

Initialise ctx as a context for \mathbb{F}_{p^d}, for a prime p and d \ge 1, with the name var for the generator (used for printing). The defining polynomial is a Conway polynomial if (p, d) is in FLINT's table; otherwise it is chosen as in the underlying module. fq_default_ctx_init chooses the representation by the rules above; fq_default_ctx_init_type uses the given type, one of the five type codes, or 0 for the automatic choice.

Neither the primality of p nor the compatibility of type with p and d is checked. FQ_DEFAULT_NMOD and FQ_DEFAULT_FMPZ_MOD create the prime field \mathbb{F}_p whatever d is; FQ_DEFAULT_FQ_ZECH, FQ_DEFAULT_FQ_NMOD and FQ_DEFAULT_NMOD need p < 2^{\mathtt{FLINT\_BITS}}, and FQ_DEFAULT_FQ_ZECH also needs q = p^d < 2^{\mathtt{FLINT\_BITS}} and builds tables of 2q + p words.

If no Conway polynomial is available (see Defining polynomials), fq_zech uses a random primitive polynomial, fq_nmod a polynomial with the fewest possible nonzero terms (fq_nmod_ctx_init_ui) and fq a random sparse irreducible polynomial (fq_ctx_init). A prime field created by these functions has the defining polynomial x, so its generator fq_default_gen is 0.

Guides#

Cite this page

The FLINT team, “fq_default_ctx_init, fq_default_ctx_init_type (fq_default.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fq_default/fq_default_ctx_init.html (generated 2026-10-20).