mpn_mod_ctx_is_pretend_field, mpn_mod_ctx_set_is_pretend_field, mpn_mod_ctx_recover_zero_divisor
#include <flint/mpn_mod.h>The methods behind gr_ctx_is_pretend_field, gr_ctx_set_is_pretend_field and gr_ctx_recover_zero_divisor. While the ring pretends to be a field, an inversion of a nonzero non-unit x fails with GR_UNABLE instead of GR_DOMAIN and records \gcd(x, n), a nontrivial factor of n, in the context (only the first one found is kept). mpn_mod_ctx_recover_zero_divisor sets res to the recorded factor and returns GR_SUCCESS, or sets res to zero and returns GR_UNABLE if none was recorded.
mpn_mod_ctx_is_pretend_field returns T_TRUE if the ring pretends to be a field or is flagged as prime, and T_FALSE otherwise. Turning the pretense off forgets the recorded factor. The flag and the factor are protected by a global lock, so several threads may compute with the same context. The guide Using mpn_mod has an example.
The FLINT team, “mpn_mod_ctx_is_pretend_field, mpn_mod_ctx_set_is_pretend_field, mpn_mod_ctx_recover_zero_divisor (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_pretend_field.html (generated 2026-10-20).
@misc{flint-doc-mpn-mod-mpn-mod-ctx-is-pretend-field,
author = {{The FLINT team}},
title = {{mpn\_mod\_ctx\_is\_pretend\_field, mpn\_mod\_ctx\_set\_is\_pretend\_field, mpn\_mod\_ctx\_recover\_zero\_divisor (mpn\_mod.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/mpn_mod/mpn_mod_ctx_is_pretend_field.html},
note = {Generated 2026-10-20}
}