FLINT3.7.0-dev

_nmod_poly_mulmid_fft_small, _nmod_poly_mullow_fft_small

Synopsis#include <flint/nmod_poly.h>
void _nmod_poly_mulmid_fft_small(nn_ptr z, nn_srcptr a, slong an, nn_srcptr b, slong bn, slong znlo, slong zn, nmod_t mod)source
void _nmod_poly_mullow_fft_small(nn_ptr z, nn_srcptr a, slong an, nn_srcptr b, slong bn, slong zn, nmod_t mod)source

Write the coefficients \mathit{znlo}, \ldots, \mathit{zn} - 1 (respectively 0, \ldots, \mathit{zn} - 1) of the product of (a, an) and (b, bn) to z, using fft_small. Require \mathit{an}, \mathit{bn} \ge 1, in either order, and 0 \le \mathit{znlo} < \mathit{zn} \le \mathit{an} + \mathit{bn} - 1; the output must not overlap the inputs.

_nmod_poly_mullow_fft_small is _nmod_poly_mulmid_fft_small with \mathit{znlo} = 0. The coefficients of the operands that no output coefficient uses (those of index at least \mathit{zn}, and the low coefficients of each operand that meet the other only below \mathit{znlo}) are dropped first. For n \le 23 they first try _nmod_poly_mulmid_fft_small_repack, which packs two coefficients into one and multiplies modulo a single 50-bit prime at half the length. Otherwise _nmod_poly_mulmid_fft_small compares two ways of computing the window, with s and \ell the lengths of the shorter and the longer operand and m = \mathit{zn} - \mathit{znlo}: as a window of the full product (_nmod_poly_mul_mid_default_mpn_ctx), with a cyclic convolution when a power of two allows it, or as a transposed product of the reversed shorter operand and the longer one, shifted and zero-padded, which costs a product of lengths s and m (_nmod_poly_mul_tr_default_mpn_ctx). The transposed product is used if m < \ell, the window does not extend beyond the full sums on both sides (\mathit{znlo} \ge s - 1 or \mathit{zn} \le \ell), and its transform is strictly shorter. After the trimming this happens for middle products such as those of Newton iteration, but never for low products, whose output is at least as long as the longer operand. See Transposed FFT.

Guides#

Cite this page

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