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

Modern Monom / Polynomial value types shared by NC algebras and the refactored F4. More...

#include "newdelete.hpp"
#include "ringelem.hpp"
#include "style.hpp"
#include <cassert>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <utility>

Go to the source code of this file.

Classes

struct  Monom
 Non-owning view onto a [length, degree, v1, v2, ..., vn] packed monomial in some externally managed buffer. More...
class  ModuleMonom
 Monom extended with a module component, a stored index, and a memoised hash — the value type of IntsSet and friends. More...
class  Polynomial< CoefficientRingType >
class  Polynomial< CoefficientRingType >::const_iterator
struct  CoefficientRingType
 Default CoefficientRingType parameter for Polynomial<...>: a thin trait whose ElementType is just ring_elem. More...

Typedefs

using Poly = Polynomial<CoefficientRingType>
using PolyList = gc_vector<Poly*>
using ConstPolyList = gc_vector<const Poly*>

Functions

std::ostream & operator<< (std::ostream &o, const Monom &m)
std::ostream & operator<< (std::ostream &o, const ModuleMonom &m)
ModuleMonom monomToModuleMonom (const Monom &a, int comp, std::pair< int *, int * > allocated_result)
template<typename T>
void appendModuleMonomToMonom (const ModuleMonom &a, int &comp, T &inserter)

Detailed Description

Modern Monom / Polynomial value types shared by NC algebras and the refactored F4.

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

Monom is an array-of-ints encoding of a non-commutative word with a degree prefix: [length, degree, var_1, ..., var_n] where length = n + 2. The length-field-first layout lets a single pointer walk past a monomial without external context. ModuleMonom adds three slots — index, hashval, Computations — in front of the Monom payload, giving the full format [len, index, hashval, Computations, deg, vars...] consumed by the resolution and module-side paths. Polynomial<CoefficientRingType> (aliased Poly) stores its terms as parallel gc_vectors — an mCoefficients vector of ElementType and a flat mMonomials vector holding the encoded monomials end-to-end — walked together by the monomial length prefix.

Modern counterpart to the legacy gbvector in gbring.hpp: gbvector is an intrusive linked list optimised for term-by-term sorted merging in the classical Buchberger inner loop, while Polynomial wins for the batch operations of F4 and the resolution code. Primary consumers are NCAlgebras/ and gb-f4/; schreyer-resolution/ carries a resolution-specialised variant.

See also
gbring.hpp
NCAlgebras/FreeAlgebra.hpp

Definition in file Polynomial.hpp.