Macaulay2 Engine
Loading...
Searching...
No Matches
NCGroebner.hpp
Go to the documentation of this file.
1#ifndef _NCGroebner_hpp_
2#define _NCGroebner_hpp_
3
38
39#include "NCAlgebras/NCReduction.hpp" // for PolynomialHeap
40#include "NCAlgebras/OverlapTable.hpp" // for OverlapTable
41#include "NCAlgebras/WordTable.hpp" // for Overlap, WordTable
42#include "NCAlgebras/SuffixTree.hpp" // for experimental SuffixTree code
43#include "Polynomial.hpp" // for Poly, ConstPolyList
44#include "newdelete.hpp" // for our_new_delete
45
46#include <iostream> // for ostream
47#include <memory> // for unique_ptr
48#include <vector> // for vector
49
50class FreeAlgebra;
51
52extern void tryOutMathicCode();
53
69{
70private:
72
74 //SuffixTree mWordTable;
76
78 std::vector<int> mGeneratorDegrees; // heft degree or sugar degree of corresponding mGroebner element.
79
80 //ConstPolyList mGroebner;
82 std::vector<int> mGroebnerDegrees; // sugar degree. -1 means removed.
83
84 mutable std::unique_ptr<PolynomialHeap> mHeap;
85
89
90public:
91 NCGroebner(const FreeAlgebra& A,
92 const ConstPolyList& input,
93 int hardDegreeLimit,
94 int strategy
95 );
96
97 const FreeAlgebra& freeAlgebra() const { return mFreeAlgebra; }
98
99 void compute(int softDegreeLimit);
100
101 // This function uses sugar degree, and heuristics to deal with non-minimally
102 // constructed Groebner basis elements
103 void computeInhomogeneous(int softDegreeLimit);
104 void computeHomogeneous(int softDegreeLimit);
105
106 const PolyList& currentValue() const;
107
108 // old version of reduction code
110 const Poly* reducee,
111 const ConstPolyList& reducers,
112 const WordTable& W) -> Poly*;
113
114 // this is the old version of the SuffixTree reduction code.
115 // static auto twoSidedReduction(const FreeAlgebra& A,
116 // const Poly* reducee,
117 // const ConstPolyList& reducers,
118 // const SuffixTree& W) -> Poly*;
119
120 auto twoSidedReduction(const ConstPolyList& reducees) const -> ConstPolyList;
121
122 // this is logically const, but not actually because the heap may be changed by
123 // this function.
124 auto twoSidedReduction(const Poly* reducee) const -> Poly*;
125
126 void addToGroebnerBasis(Poly* toAdd);
127
129
130 void updateOverlaps(const Poly* toAdd);
131
132 auto initReductionOnly() -> void;
133
134 static auto createOverlapPoly(const FreeAlgebra& A,
135 const PolyList& polyList,
136 int polyIndex1,
137 int polyIndex2,
138 int overlapIndex) -> Poly*;
139
140 auto createOverlapPoly(Overlap o) const -> Poly*;
141 auto createOverlapLeadWord(Poly& wordAsPoly, Overlap o) const -> void;
142
143 auto overlapWordLength(Overlap o) const -> int;
144 auto overlapHeft(Overlap o) const -> int;
145
146 auto printOverlapData(std::ostream& o, Overlap overlap) const -> void;
147
148 auto insertNewOverlaps(std::vector<Overlap>& newOverlaps) -> void;
149
150 auto isOverlapNecessary(Overlap o) const -> bool;
151
152 auto displayGroebnerBasis(std::ostream& o) const -> void;
153
154private:
155 // utility functions
156 // move to FreeAlgebra?
157 ring_elem getCoeffOfMonom(const Poly& f, const Monom& m);
158
159};
160
161#endif
162
163// Local Variables:
164// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
165// indent-tabs-mode: nil
166// End:
167
void tryOutMathicCode()
PolynomialHeap abstract interface — batched-subtraction heap for non-commutative reduction.
std::tuple< int, int, int, bool > Overlap
OverlapTable — degree-sorted queue of pending word overlaps for non-commutative GB drivers.
gc_vector< const Poly * > ConstPolyList
Polynomial< CoefficientRingType > Poly
gc_vector< Poly * > PolyList
Modern Monom / Polynomial value types shared by NC algebras and the refactored F4.
SuffixTree / SuffixTreeNode — experimental generalised suffix tree for non-commutative leading-word l...
WordTable / WordWithDataTable — leading-word indices for non-commutative Gröbner basis lookup.
Free associative algebra over a coefficient ring: the non-commutative analogue of PolynomialRing.
auto overlapWordLength(Overlap o) const -> int
std::vector< int > mGroebnerDegrees
void computeInhomogeneous(int softDegreeLimit)
auto twoSidedReduction(const ConstPolyList &reducees) const -> ConstPolyList
std::unique_ptr< PolynomialHeap > mHeap
void updateOverlaps(const Poly *toAdd)
NCGroebner(const FreeAlgebra &A, const ConstPolyList &input, int hardDegreeLimit, int strategy)
std::vector< int > mGeneratorDegrees
void autoreduceByLastElement()
const FreeAlgebra & mFreeAlgebra
void compute(int softDegreeLimit)
int mHardDegreeLimit
int mTopComputedDegree
auto insertNewOverlaps(std::vector< Overlap > &newOverlaps) -> void
auto isOverlapNecessary(Overlap o) const -> bool
auto overlapHeft(Overlap o) const -> int
auto twoSidedReductionOld(const FreeAlgebra &A, const Poly *reducee, const ConstPolyList &reducers, const WordTable &W) -> Poly *
void computeHomogeneous(int softDegreeLimit)
const PolyList & currentValue() const
auto createOverlapLeadWord(Poly &wordAsPoly, Overlap o) const -> void
OverlapTable mOverlapTable
static auto createOverlapPoly(const FreeAlgebra &A, const PolyList &polyList, int polyIndex1, int polyIndex2, int overlapIndex) -> Poly *
PolyList mGroebner
auto displayGroebnerBasis(std::ostream &o) const -> void
const FreeAlgebra & freeAlgebra() const
WordTable mWordTable
auto printOverlapData(std::ostream &o, Overlap overlap) const -> void
ring_elem getCoeffOfMonom(const Poly &f, const Monom &m)
const ConstPolyList mInput
auto initReductionOnly() -> void
void addToGroebnerBasis(Poly *toAdd)
Per-degree FIFO queue of pending overlaps for the NC Groebner basis driver to process.
Index of Words (non-commutative monomials) with subword, prefix/suffix, and overlap lookup used by th...
Definition WordTable.hpp:89
our_new_delete — per-class opt-in routing of new / delete through bdwgc.
Non-owning view onto a [length, degree, v1, v2, ..., vn] packed monomial in some externally managed b...