FLINT3.7.0-dev

gr_mpoly_mul, gr_mpoly_mul_heap, gr_mpoly_mul_heap_threaded, gr_mpoly_mul_monomial

Synopsis#include <flint/gr_mpoly.h>
int gr_mpoly_mul(gr_mpoly_t A, const gr_mpoly_t B, const gr_mpoly_t C, gr_mpoly_ctx_t ctx)source
int gr_mpoly_mul_heap(gr_mpoly_t A, const gr_mpoly_t B, const gr_mpoly_t C, gr_mpoly_ctx_t ctx)source
int gr_mpoly_mul_heap_threaded(gr_mpoly_t A, const gr_mpoly_t B, const gr_mpoly_t C, gr_mpoly_ctx_t ctx)source
int gr_mpoly_mul_monomial(gr_mpoly_t A, const gr_mpoly_t B, const gr_mpoly_t C, gr_mpoly_ctx_t ctx)source

Set A to the product BC. The heap version uses Johnson's algorithm, which merges the |B| sorted rows b_i C with a heap of size |B|, with O(|B| |C| \log |B|) monomial comparisons and memory proportional to the output; the heap_threaded version divides the output among threads. The monomial version requires C to have one term.

The default gr_mpoly_mul squares when B and C are the same object (see gr_mpoly_sqr), uses the monomial algorithm if one factor has a single term, and otherwise the heap algorithm, threaded when |B| |C| > 10000, both have more than two terms and threads are available. Products with more than the size limit of the context in terms return GR_UNABLE.

Cite this page

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