flint_mpn_mul_complex, flint_mpn_sqr_complex
#include <flint/mpn_extras.h>void flint_mpn_mul_complex(nn_ptr zr, slong * zr_len, nn_ptr zi, slong * zi_len, nn_srcptr ar, mp_size_t arn, int ar_sgn, nn_srcptr ai, mp_size_t ain, int ai_sgn, nn_srcptr br, mp_size_t brn, int br_sgn, nn_srcptr bi, mp_size_t bin, int bi_sgn)sourcevoid flint_mpn_sqr_complex(nn_ptr zr, slong * zr_len, nn_ptr zi, slong * zi_len, nn_srcptr ar, mp_size_t arn, int ar_sgn, nn_srcptr ai, mp_size_t ain, int ai_sgn)sourceSets z_r + z_i i = (a_r + a_i i)(b_r + b_i i), respectively (a_r + a_i i)^2. Each part has its own length, at least 1 limb, not necessarily normalised. A signed length is written for each output: the magnitude occupies |*zr_len| limbs and a negative value means that the part is negative. Limbs beyond the signed length are not significant. Each output must have room for \max(\mathit{arn}, \mathit{ain}) + \max(\mathit{brn}, \mathit{bin}) + 1 limbs (2 \max(\mathit{arn}, \mathit{ain}) + 1 for the square).
The algorithm is chosen from the shape: the schoolbook method (four real products, or two squares and a product) when a part is much shorter than its partner, Karatsuba's three-product formula when the parts of each operand are of similar length, and a transformed method on fft_small transforms for large balanced operands (from flint_mpn_mul_complex_fft_cutoff and flint_mpn_sqr_complex_fft_cutoff limbs). The two operands need not be of similar size.
The FLINT team, “flint_mpn_mul_complex, flint_mpn_sqr_complex (mpn_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mpn_extras/flint_mpn_mul_complex.html (generated 2026-10-20).
@misc{flint-doc-mpn-extras-flint-mpn-mul-complex,
author = {{The FLINT team}},
title = {{flint\_mpn\_mul\_complex, flint\_mpn\_sqr\_complex (mpn\_extras.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/mpn_extras/flint_mpn_mul_complex.html},
note = {Generated 2026-10-20}
}