FLINT3.7.0-dev

gr_poly_preinv_set, _gr_poly_preinv_set, gr_poly_preinv_set_newton, _gr_poly_preinv_set_newton, _gr_poly_preinv_set_plain, gr_poly_preinv_set_sparse, _gr_poly_preinv_set_sparse, gr_poly_preinv_set_transformed, _gr_poly_preinv_set_transformed

Synopsis#include <flint/gr_poly.h>
int gr_poly_preinv_set(gr_poly_preinv_t P, const gr_poly_t f, gr_ctx_t ctx)source
int _gr_poly_preinv_set(gr_poly_preinv_t P, gr_srcptr f, slong lenf, gr_ctx_t ctx)source
int gr_poly_preinv_set_newton(gr_poly_preinv_t P, const gr_poly_t f, gr_ctx_t ctx)source
int _gr_poly_preinv_set_newton(gr_poly_preinv_t P, gr_srcptr f, slong lenf, gr_ctx_t ctx)source
int _gr_poly_preinv_set_plain(gr_poly_preinv_t P, gr_srcptr f, slong lenf, gr_ctx_t ctx)source
int gr_poly_preinv_set_sparse(gr_poly_preinv_t P, const gr_poly_t f, gr_ctx_t ctx)source
int _gr_poly_preinv_set_sparse(gr_poly_preinv_t P, gr_srcptr f, slong lenf, gr_ctx_t ctx)source
int gr_poly_preinv_set_transformed(gr_poly_preinv_t P, const gr_poly_t f, gr_ctx_t ctx)source
int _gr_poly_preinv_set_transformed(gr_poly_preinv_t P, gr_srcptr f, slong lenf, gr_ctx_t ctx)source

Set P to the nonzero modulus f, storing a copy of it, with a representation chosen automatically, the Newton representation, the Newton representation without an inverse (ordinary division), the sparse representation or the transformed representation (GR_UNABLE if unavailable). Return GR_DOMAIN if f = 0 and GR_UNABLE if its leading coefficient cannot be inverted.

The automatic choice is the ring method GR_METHOD_POLY_PREINV_SET, which can take the degree, the sparsity and the coefficient size into account. The default gr_generic_poly_preinv_set chooses ordinary division for moduli of length at most 8, the sparse representation for at most 8 nonzero terms below the leading term, and the Newton representation otherwise. Rings with cheap elements use larger cutoffs for ordinary division (32 for nmod, with a sparse cutoff of 5 terms). nmod, fmpz_mod, mpn_mod and the contexts of gr_ctx_init_gr_poly_quotient override the method.

Cite this page

The FLINT team, “gr_poly_preinv_set, _gr_poly_preinv_set, gr_poly_preinv_set_newton, _gr_poly_preinv_set_newton, _gr_poly_preinv_set_plain, gr_poly_preinv_set_sparse, _gr_poly_preinv_set_sparse, gr_poly_preinv_set_transformed, _gr_poly_preinv_set_transformed (gr_poly.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_poly/gr_poly_preinv_set.html (generated 2026-10-20).