FLINT3.7.0-dev

_gr_poly_powmod_ui_binexp, gr_poly_powmod_ui_binexp, _gr_poly_powmod_ui_binexp_preinv, gr_poly_powmod_ui_binexp_preinv, _gr_poly_powmod_fmpz_binexp, gr_poly_powmod_fmpz_binexp, _gr_poly_powmod_fmpz_binexp_preinv, gr_poly_powmod_fmpz_binexp_preinv, _gr_poly_powmod_fmpz_sliding_preinv, gr_poly_powmod_fmpz_sliding_preinv, _gr_poly_powmod_x_fmpz_preinv, gr_poly_powmod_x_fmpz_preinv

Synopsis#include <flint/gr_poly.h>
int _gr_poly_powmod_ui_binexp(gr_ptr res, gr_srcptr poly, slong len, ulong e, gr_srcptr f, slong lenf, gr_ctx_t ctx)source
int gr_poly_powmod_ui_binexp(gr_poly_t res, const gr_poly_t poly, ulong e, const gr_poly_t f, gr_ctx_t ctx)source
int _gr_poly_powmod_ui_binexp_preinv(gr_ptr res, gr_srcptr poly, slong len, ulong e, gr_srcptr f, slong lenf, gr_srcptr finv, slong lenfinv, gr_ctx_t ctx)source
int gr_poly_powmod_ui_binexp_preinv(gr_poly_t res, const gr_poly_t poly, ulong e, const gr_poly_t f, const gr_poly_t finv, gr_ctx_t ctx)source
int _gr_poly_powmod_fmpz_binexp(gr_ptr res, gr_srcptr poly, slong len, const fmpz_t e, gr_srcptr f, slong lenf, gr_ctx_t ctx)source
int gr_poly_powmod_fmpz_binexp(gr_poly_t res, const gr_poly_t poly, const fmpz_t e, const gr_poly_t f, gr_ctx_t ctx)source
int _gr_poly_powmod_fmpz_binexp_preinv(gr_ptr res, gr_srcptr poly, slong len, const fmpz_t e, gr_srcptr f, slong lenf, gr_srcptr finv, slong lenfinv, gr_ctx_t ctx)source
int gr_poly_powmod_fmpz_binexp_preinv(gr_poly_t res, const gr_poly_t poly, const fmpz_t e, const gr_poly_t f, const gr_poly_t finv, gr_ctx_t ctx)source
int _gr_poly_powmod_fmpz_sliding_preinv(gr_ptr res, gr_srcptr poly, slong len, const fmpz_t e, ulong k, gr_srcptr f, slong lenf, gr_srcptr finv, slong lenfinv, gr_ctx_t ctx)source
int gr_poly_powmod_fmpz_sliding_preinv(gr_poly_t res, const gr_poly_t poly, const fmpz_t e, ulong k, const gr_poly_t f, const gr_poly_t finv, gr_ctx_t ctx)source
int _gr_poly_powmod_x_fmpz_preinv(gr_ptr res, const fmpz_t e, gr_srcptr f, slong lenf, gr_srcptr finv, slong lenfinv, gr_ctx_t ctx)source
int gr_poly_powmod_x_fmpz_preinv(gr_poly_t res, const fmpz_t e, const gr_poly_t f, const gr_poly_t finv, gr_ctx_t ctx)source

Set res to poly raised to the power e modulo f, by binary exponentiation, by sliding window exponentiation with window size k (k = 0 chooses it from the size of e), or, for the x versions, x^e \bmod f with shifts instead of multiplications by the base.

The underscore versions with a base require a reduced base (\mathit{len} < \mathit{lenf}), \mathit{lenf} \ge 2 and e \ge 0, write \mathit{lenf} - 1 coefficients (zero-padded, not normalised), and allow res to be poly; the x version requires \mathit{lenf} \ge 3. The preinv versions accept \mathit{lenfinv} = 0, in which case ordinary division is used. The intermediate powers are kept at their actual length, so that powers of a polynomial of small degree, such as x, cost nothing until the degree reaches \deg f; the iterated Frobenius x^{p^i} is thus free while p^i < \deg f.

Cite this page

The FLINT team, “_gr_poly_powmod_ui_binexp, gr_poly_powmod_ui_binexp, _gr_poly_powmod_ui_binexp_preinv, gr_poly_powmod_ui_binexp_preinv, _gr_poly_powmod_fmpz_binexp, gr_poly_powmod_fmpz_binexp, _gr_poly_powmod_fmpz_binexp_preinv, gr_poly_powmod_fmpz_binexp_preinv, _gr_poly_powmod_fmpz_sliding_preinv, gr_poly_powmod_fmpz_sliding_preinv, _gr_poly_powmod_x_fmpz_preinv, gr_poly_powmod_x_fmpz_preinv (gr_poly.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_poly/_gr_poly_powmod_ui_binexp.html (generated 2026-10-20).