gr_mpoly_divides, gr_mpoly_divides_heap, gr_mpoly_divides_heap_threaded
#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)sourceint gr_mpoly_divides_heap(gr_mpoly_t Q, const gr_mpoly_t A, const gr_mpoly_t B, gr_mpoly_ctx_t ctx)sourceint gr_mpoly_divides_heap_threaded(gr_mpoly_t Q, const gr_mpoly_t A, const gr_mpoly_t B, gr_mpoly_ctx_t ctx)sourceChecked exact division. If B divides A, set Q = A / B and return GR_SUCCESS; if not, set Q 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 B 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, |B| > 2, the ring is thread-safe and threads are available.
Guides#
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-10-20).
@misc{flint-doc-gr-mpoly-gr-mpoly-divides,
author = {{The FLINT team}},
title = {{gr\_mpoly\_divides, gr\_mpoly\_divides\_heap, gr\_mpoly\_divides\_heap\_threaded (gr\_mpoly.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/gr_mpoly/gr_mpoly_divides.html},
note = {Generated 2026-10-20}
}