Macaulay2 Engine
Loading...
Searching...
No Matches
NCReduction.hpp
Go to the documentation of this file.
1#ifndef __ncreduction_hpp__
2#define __ncreduction_hpp__
3
36
37#include "Polynomial.hpp" // for Poly, Monom (ptr only)
38#include "ringelem.hpp" // for ring_elem
39
40#include <iosfwd> // for string
41#include <memory> // for unique_ptr
42#include <utility> // for pair
43
44class FreeAlgebra;
45class Word;
46
65{
66public:
67 virtual ~PolynomialHeap() {}
68
69 virtual PolynomialHeap& addPolynomial(const Poly& poly) = 0;
70
72 Word left,
73 Word right,
74 const Poly& poly) = 0;
75
76 virtual bool isZero() = 0;
77
78 // viewLeadTerm: should only be called if isZero() returns false.
79 virtual std::pair<Monom, ring_elem> viewLeadTerm() = 0;
80
81 // removeLeadTerm: should only be called if isZero() returns false.
82 virtual void removeLeadTerm() = 0;
83
84 virtual Poly* value() = 0; // returns the polynomial
85
86 virtual size_t getMemoryUsedInBytes() = 0;
87
88 virtual void clear() = 0;
89
90 virtual std::string getName() const = 0; // returns the 'type' of the underlying heap structure
91};
92
93enum class HeapType {
95 Map, // based on std::map
96 PriorityQueue, // based on std::priority_queue (with underlying std::vector)
101 // HashedGeobucket
102};
103
104HeapType getHeapType(int strategy);
105std::string getHeapName(HeapType type);
106
107std::unique_ptr<PolynomialHeap>
109
110#endif
111
112// Local Variables:
113// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
114// indent-tabs-mode: nil
115// End:
std::unique_ptr< PolynomialHeap > makePolynomialHeap(HeapType type, const FreeAlgebra &F)
HeapType
@ NaiveDedupGeobucket
std::string getHeapName(HeapType type)
HeapType getHeapType(int strategy)
Polynomial< CoefficientRingType > Poly
Modern Monom / Polynomial value types shared by NC algebras and the refactored F4.
Free associative algebra over a coefficient ring: the non-commutative analogue of PolynomialRing.
virtual ~PolynomialHeap()
virtual void removeLeadTerm()=0
virtual bool isZero()=0
virtual std::pair< Monom, ring_elem > viewLeadTerm()=0
virtual Poly * value()=0
virtual PolynomialHeap & addPolynomial(ring_elem coeff, Word left, Word right, const Poly &poly)=0
virtual void clear()=0
virtual size_t getMemoryUsedInBytes()=0
virtual std::string getName() const =0
virtual PolynomialHeap & addPolynomial(const Poly &poly)=0
Abstract interface for accumulating a polynomial as a sum of (coeff, left * poly * right) contributio...
Non-owning view of a non-commutative word: [begin, end) of int variable indices.
Definition Word.hpp:56
ring_elem — the universal value type carried by every Ring* in the engine.