mpn_ctx_init, mpn_ctx_clear
#include <flint/fft_small.h>The eight primes are p_0 = p (or, if p is not prime, the first prime in the sequence below) and then the next primes of the sequence obtained by repeatedly subtracting 2^{v + 1} from the previous value, where 2^v \| p - 1; when that would lose a bit, the bit size is kept and the two-adic valuation is decreased by one. Each prime must pass fft_small_mulmod_satisfies_bounds and have 2^4 \mid p - 1, or sd_fft_ctx_init_prime throws. Other starting values are meant only for testing: the packing profiles, the two-prime pipeline and the shortcut for moduli that are context primes all assume 50-bit primes.
Initialisation computes the twiddle factors for transforms of length up to 2^{12}, the cofactors P/p_i for the Chinese remainder theorem, and the tables 2^j \bmod p_i for j < 256. Longer twiddle tables are added on first use.
The FLINT team, “mpn_ctx_init, mpn_ctx_clear (fft_small.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fft_small/mpn_ctx_init.html (generated 2026-10-20).
@misc{flint-doc-fft-small-mpn-ctx-init,
author = {{The FLINT team}},
title = {{mpn\_ctx\_init, mpn\_ctx\_clear (fft\_small.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fft_small/mpn_ctx_init.html},
note = {Generated 2026-10-20}
}