FLINT3.7.0-dev

_fmpzi_poly_mulmid

Synopsis#include <flint/fmpzi.h>
void _fmpzi_poly_mulmid(fmpzi_struct * res, const fmpzi_struct * poly1, slong len1, const fmpzi_struct * poly2, slong len2, slong nlo, slong nhi)source

Sets (res, nhi - nlo) to the coefficients at indices [\mathtt{nlo}, \mathtt{nhi}) of the product of the Gaussian integer polynomials (poly1, len1) and (poly2, len2), choosing an algorithm. Assumes that len1 and len2 are positive and that 0 \le nlo < nhi \le len1 + len2 - 1; the lengths may be given in either order, and res must not alias the inputs. This is the multiplication used by the fmpzi generic ring for polynomial multiplication, low products and middle products.

The choice depends on b, the average over the two operands of the larger part size in bits, and on q, the number of coefficient products in the window per operand coefficient (n/2 for an n \times n product, n/3 for the Newton middle product (2n - 1) \times n \to [n - 1, 2n - 1)): the classical algorithm for windows of at most 12 products; four real products when a part vanishes or is much smaller than the other (they skip the vanishing products); _fmpzi_poly_mulmid_classical_fft_small from 8192 bits up to a bound on q increasing with b; real products, three (Karatsuba) from about 256 bits, below a bound on q decreasing with b; and otherwise _fmpzi_poly_mulmid_KS, except for _fmpzi_poly_mulmid_SS on squares at 384-3072 bits, short full products at 768-1536 bits and middle products whose cyclic transform saves a quarter of the length at 768-3072 bits (short ones) and from 24576 bits, and for huge products (m_1 + m_2 \ge 32768 and (len_1 + len_2)(m_1 + m_2) > 2.5 \cdot 10^8 for the larger part sizes m_1, m_2 of the operands), where Schoenhage-Strassen runs within about 10% of the time in about a fifth of the memory. The boundaries were fitted to timings on x86-64 with uniformly random coefficients.

Cite this page

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