FLINT3.7.0-dev

gr_generic_pow_ui_sliding, gr_generic_pow_fmpz_sliding

Synopsis#include <flint/gr_generic.h>
int gr_generic_pow_ui_sliding(gr_ptr f, gr_srcptr g, ulong pow, gr_ctx_t ctx)source
int gr_generic_pow_fmpz_sliding(gr_ptr f, gr_srcptr g, const fmpz_t pow, gr_ctx_t ctx)source

Compute x^e for e \ge 0 by the sliding window method with a window size k between 1 and 11 bits chosen from the bit length of e, using fewer multiplications than binary exponentiation for large exponents at the cost of a table of 2^{k-1} odd powers. gr_generic_pow_fmpz_sliding returns GR_DOMAIN for negative e. The output may alias the input.

Cite this page

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