Macaulay2 Engine
Loading...
Searching...
No Matches
f4-spairs.hpp File Reference

F4SPairSet — priority-queue + pruning logic for F4 S-pairs. More...

#include <queue>
#include "MemoryBlock.hpp"
#include "f4/f4-types.hpp"
#include "f4/memblock.hpp"
#include "f4/moninfo.hpp"
#include "f4/varpower-monomial.hpp"

Go to the source code of this file.

Classes

class  F4SPairSet
 S-pair scheduling queue used by F4GB: collects pairs, deduplicates them, and hands out the next degree's worth on demand. More...

Detailed Description

F4SPairSet — priority-queue + pruning logic for F4 S-pairs.

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

Declares F4SPairSet, the structure that manages the S-pair worklist for the F4 inner loop. The pair records live in std::vector<spair> mSPairs; an std::priority_queue<size_t, std::vector<size_t>, SPairCompare> mSPairQueue holds indices into that vector and SPairCompare orders them lowest-degree-first, breaking ties by the spair's i field (one of the two GB indices that form the pair — not the lcm). make_spair(type, deg, i, j) pushes a new spair onto mSPairs and bump-allocates space for its lcm monomial out of MemoryBlock mSPairLCMs; the lcm slot is allocated correctly sized but not initialised, so the caller must fill it. Construction of new pairs runs through pre_spair (allocated from F4MemoryBlock<pre_spair> PS) with a varpower scratch arena F4MemoryBlock<varpower_word> VP.

After a new basis element joins, pair_not_needed(p, m) tests one pair against the chain criterion and remove_unneeded_pairs() sweeps the queue for every pair the new element subsumes (returning the count, accumulated into nsaved_unneeded). Without these prunes the queue would grow quadratically in basis size for any Buchberger-style workload. The spair struct and SPairCompare itself live in f4-types.hpp; the classical spair.hpp counterpart powers gbA and friends rather than F4. When compiled WITH_TBB the constructor takes the shared mtbb::task_arena& so pair construction can run on the same scheduler F4GB uses for Gauss.

See also
f4.hpp
f4-types.hpp
memblock.hpp

Definition in file f4-spairs.hpp.