Macaulay2 Engine
Loading...
Searching...
No Matches
OverlapTable.hpp
Go to the documentation of this file.
1#ifndef _OverlapTable_hpp_
2#define _OverlapTable_hpp_
3
43
44#include "Polynomial.hpp" // for ConstPolyList
45
46#include <deque> // for deque
47#include <map> // for map
48#include <ostream> // for ostream
49#include <tuple> // for tuple
50#include <utility> // for pair
51
52// tuple is (i,j,k) where i is index of first word,
53// j is position of overlap in first word and k is
54// index of the second word
55// the bool at the end determines whether the overlap still needs to be computed
56using Overlap = std::tuple<int,int,int,bool>;
57
58using OverlapMap = std::map<std::pair<int,bool>,std::deque<Overlap>>;
59
76{
77public:
78 friend std::ostream& operator<<(std::ostream& ostr, const OverlapTable& overlapTable);
79
80 OverlapTable() : mPolyList(nullptr) {};
81 OverlapTable(ConstPolyList* polyList) : mPolyList(polyList) {};
82
83 // will call find to see if degree exists, and if not will call
84 // insert. If degree exists, append overlap to value of degree
85 auto insert(int deg, bool isGenerator, Overlap o) -> void;
86
87 // is the overlap map empty?
88 auto isFinished() const -> bool;
89 // is the overlap map empty in degrees <= topDegree?
90 auto isFinished(int topDegree) const -> bool;
91
92 // returns the lowest degree and a pointer to the overlaps
93 // in that degree if isFinished returns true. Otherwise
94 // return (-1,nullptr).
95 auto nextDegreeOverlaps() -> std::pair<int,std::deque<Overlap>*>;
96
97 auto size() const -> size_t;
98
99 auto removeLowestDegree() -> void; // TODO: logic BUG in inhomogeneous case: won't delete what we want!
100
101 auto overlapWordLength(Overlap o) const -> int;
102
103 // wipes out the entire data structure
104 auto clear() -> void { mOverlapMap.clear(); };
105
106 auto dump(std::ostream& ostr, bool outputDeques) const -> std::ostream&;
107
109
110private:
113};
114
115std::ostream& operator<<(std::ostream& ostr, const OverlapTable& overlapTable);
116auto operator<<(std::ostream& o, Overlap& a) -> std::ostream&;
117
118#endif
119
120// Local Variables:
121// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
122// indent-tabs-mode: nil
123// End:
std::tuple< int, int, int, bool > Overlap
std::map< std::pair< int, bool >, std::deque< Overlap > > OverlapMap
std::ostream & operator<<(std::ostream &ostr, const OverlapTable &overlapTable)
gc_vector< const Poly * > ConstPolyList
Modern Monom / Polynomial value types shared by NC algebras and the refactored F4.
OverlapTable(ConstPolyList *polyList)
auto insert(int deg, bool isGenerator, Overlap o) -> void
auto isFinished() const -> bool
auto dump(std::ostream &ostr, bool outputDeques) const -> std::ostream &
auto overlapWordLength(Overlap o) const -> int
auto removeLowestDegree() -> void
auto clear() -> void
ConstPolyList * mPolyList
friend std::ostream & operator<<(std::ostream &ostr, const OverlapTable &overlapTable)
auto size() const -> size_t
auto nextDegreeOverlaps() -> std::pair< int, std::deque< Overlap > * >
OverlapMap mOverlapMap
OverlapMap & overlapMap()
Per-degree FIFO queue of pending overlaps for the NC Groebner basis driver to process.
STL namespace.