FLINT3.7.0-dev

gr_mpoly_divides, gr_mpoly_divides_heap, gr_mpoly_divides_heap_threaded

Synopsis#include <flint/gr_mpoly.h>
int gr_mpoly_divides(gr_mpoly_t Q, const gr_mpoly_t A, const gr_mpoly_t B, gr_mpoly_ctx_t ctx)source
int gr_mpoly_divides_heap(gr_mpoly_t Q, const gr_mpoly_t A, const gr_mpoly_t B, gr_mpoly_ctx_t ctx)source
int gr_mpoly_divides_heap_threaded(gr_mpoly_t Q, const gr_mpoly_t A, const gr_mpoly_t B, gr_mpoly_ctx_t ctx)source

Checked exact division. If BB divides AA, set Q=A/BQ = A / B and return GR_SUCCESS; if not, set QQ to zero and return GR_DOMAIN; if divisibility cannot be decided, return GR_UNABLE. Division by zero gives GR_DOMAIN (except in the zero ring).

The heap version is the heap division algorithm of Monagan and Pearce, which stops as soon as a remainder term appears that the leading monomial of BB does not divide. The heap_threaded version splits the work among threads for large inputs over thread-safe rings and otherwise calls the serial algorithm. The default handles a single-term divisor directly, requires an integral domain for the general case (GR_UNABLE otherwise, since this is also the method behind gr_div), and uses the threaded version when ∣A∣>500|A| > 500, ∣B∣>2|B| > 2, the ring is thread-safe and threads are available.

Guides#

Cite this page

The FLINT team, “gr_mpoly_divides, gr_mpoly_divides_heap, gr_mpoly_divides_heap_threaded (gr_mpoly.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_mpoly/gr_mpoly_divides.html (generated 2026-11-02).