Macaulay2 Engine
Loading...
Searching...
No Matches
montable.hpp File Reference

MonomialTable — leading-monomial divisor index used by the GB reducer. More...

#include "mem.hpp"
#include <vector>
#include <memory>
#include <algorithm>
#include <stdio.h>
#include <stddef.h>
#include "ExponentVector.hpp"
#include "newdelete.hpp"
#include "style.hpp"

Go to the source code of this file.

Classes

class  MonomialTable
 Indexed table of monomials with fast "find a divisor" lookup, keyed by a free integer val per entry. More...
struct  MonomialTable::mon_term
 Doubly-linked-list node of a MonomialTable's per-component monomial list. More...

Detailed Description

MonomialTable — leading-monomial divisor index used by the GB reducer.

Note
AI-generated documentation. Verify against the source before relying on it.

Declares MonomialTable, the data structure GB code queries thousands of times per reduction: given a monomial m, find a basis element whose leading monomial divides m. Each mon_term carries a doubly-linked-list pair (_next / _prev), the borrowed exponent pointer _lead (the owning polynomial still owns it, with trailing sugar entries ignored), a precomputed bitmask _mask that fast-rejects non-divisors before a full exponent compare, and the basis index _val. Per the in-source comment, terms are kept in lex order so the divisibility scan can prune early; the implementation maintains a per-component list head in _head and a _last_match cache to speed repeated queries.

Public operations: make(nvars) (the actual constructor), insert(exp, comp, id), find_divisor, find_divisors(max, exp, comp, *result), and find_exact(exp, comp). The static make_minimal and minimalize helpers (defined at montable.cpp:367 and :297) read as if they compute a minimal subset by lead monomial, but they are declared private with no friend access and no internal self-calls — nothing in the engine can reach them, so they are effectively dead scaffolding kept around in the header. The coefficient-aware ZZ-coefficient analogue lives in montableZZ.hpp, where the divisibility test additionally checks that a candidate's leading coefficient divides the reducee's.

See also
montableZZ.hpp
gb-default.hpp
ExponentVector.hpp

Definition in file montable.hpp.