FLINT3.7.0-dev

mpn_mod_ctx_is_field, mpn_mod_ctx_set_is_field

Synopsis#include <flint/mpn_mod.h>
truth_t mpn_mod_ctx_is_field(gr_ctx_t ctx)source
int mpn_mod_ctx_set_is_field(gr_ctx_t ctx, truth_t is_field)source

Return or set the primality flag of the modulus. mpn_mod_ctx_set_is_field always returns GR_SUCCESS; nothing is checked. These are the gr_ctx_is_field and gr_ctx_set_is_field methods (the flag also answers gr_ctx_is_integral_domain and gr_ctx_is_unique_factorization_domain).

Setting the flag to T_TRUE for a prime modulus lets the generic algorithms for fields (polynomial factorisation and root finding, square roots, and so on) run instead of returning GR_UNABLE. Setting it for a composite modulus gives undefined results.

Cite this page

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