FLINT3.7.0-dev

_mpoly_heap_insert, _mpoly_heap_insert1

Synopsis#include <flint/mpoly.h>
int _mpoly_heap_insert(mpoly_heap_s * heap, ulong * exp, void * x, slong * next_loc, slong * heap_len, slong N, const ulong * cmpmask)source
void _mpoly_heap_insert1(mpoly_heap1_s * heap, ulong exp, void * x, slong * next_loc, slong * heap_len, ulong maskhi)source

Insert the chain node x with monomial exp into the heap. The entry of index 0 is unused, so *heap_len is one more than the number of entries. If an entry with the same monomial is found at the top, at index *next_loc, or on the path from the insertion point to the root, x is chained to it (and *next_loc remembers its position); otherwise a new entry is created and *heap_len is incremented. _mpoly_heap_insert returns 1 if a new entry was created and 0 if the node was chained. The one-word version takes maskhi = cmpmask[0]. Initialise *next_loc to a value larger than any heap length.

Cite this page

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