Macaulay2 Engine
Loading...
Searching...
No Matches
monomial-collection.hpp File Reference

IntsSet<Configuration> — set of monomials with insert / lookup / insertion-ordered iteration. More...

#include "Polynomial.hpp"
#include "style.hpp"
#include <memtailor/Arena.h>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <typeinfo>
#include <unordered_set>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  ModuleMonomLessThan
 Strict-weak-order comparator on ModuleMonom, used by IntsSet::sort to reorder the insertion-ordered mElements list. More...
class  ModuleMonomHash
 Hash functor on ModuleMonom, forwarding to ModuleMonom::hash. More...
class  ModuleMonomEq
 Equality functor on ModuleMonom, forwarding to operator==. More...
class  ModuleMonomDefaultConfigOrig
 Legacy IntsSet configuration that bundles hashing, equality, and a display helper into one functor object. More...
class  ModuleMonomDefaultConfig
 Current IntsSet configuration: exposes Hash and Eq as discrete member functors so the unordered_set can use them directly. More...
class  IntsSet< Configuration >

Typedefs

using ModuleMonomialSet = IntsSet<ModuleMonomDefaultConfig>

Functions

template<typename T1, typename T2>
std::ostream & operator<< (std::ostream &o, const std::pair< T1, T2 > &p)
template<typename T>
void PRINT_ELEMENTS (const T &collection, const std::string &prefix)
template<typename T>
void printHashTableState (const T &cont)

Detailed Description

IntsSet<Configuration> — set of monomials with insert / lookup / insertion-ordered iteration.

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

Declares the templated IntsSet<Configuration>, the engine's in-transition "set of monomials" helper used by M2FreeAlgebra and the non-commutative arithmetic paths to track which Monom / ModuleMonom values have appeared during a multiplication or product. The live Configuration interface is just Hash and Eq functor members (the constructor forwards them as the std::unordered_set policies); a copyToModuleElement shape appears in the template's own comment list (line 240) as a documented eventual addition, but no Configuration in this header actually defines or uses it. The API splits insert from lookup: insert(m, comp) allocates the encoded ModuleMonom in the arena and pushes it onto the insertion-ordered mElements vector if new (returning true) or rolls the allocation back if already present (returning false); find(m, comp) is the separate read path, returning (index, true) on a hit and (-1, false) otherwise. Iteration via uniqueMonoms() walks mElements in insertion order. Storage is an arena from <memtailor/Arena.h> plus a std::unordered_set hash index, so per-monomial work stays bump-pointer cheap.

The header's TODO block flags a planned rename of IntsSet to a non-templated ModuleMonomSet, a new VarPowerMonom companion, hash-function improvements, and migration of the commutative gb-f4/ MonomialHashTable toward the same pattern — the file is mid-refactor.

See also
Polynomial.hpp
M2FreeAlgebra.hpp

Definition in file monomial-collection.hpp.