Macaulay2 Engine
Loading...
Searching...
No Matches
SPairs.hpp
Go to the documentation of this file.
1#pragma once
2
44
45#include "MonomialTypes.hpp"
46#include "MonomialView.hpp"
47#include "Basis.hpp"
48
49#include <map>
50
51// Each spair's monomials will be included in a special "hash table".
52// What about "pre-spairs"? Are they in their own, or not yet inserted?
53// Maybe try both?
54
55// Inserting new spairs.
56// Making pre-spairs
57// Sort them
58// Find minimal elements (try via masks, via MonomialIdeal type structure, and maybe some mathic structures?)
59// insert each spair directly.
60//
61// Grabbing a set of spairs to do (but if interrupted, don't lose the pairs!)
62// sort them? at least by degree...
63// how to remove a pair that isn't required? (the more complicated spair approach).
64
65// Maybe what I should do before meeting Frank:
66// Translate Matrix to Basis.
67// Translate Basis to Matrix.
68// Keep free module, ring around.
69
70// Then: Frank and I can do:
71// 1A. macaulay matrix build (maybe mostly use NCGB code)
72// 1B. linear algebra part (use NCGB code)
73// 2. spair part (this part can be based on f4 code)
74// 3. tracing/QQ part (this part is new)
75
76// Want: allow exterior algebra, maybe Weyl algebra.
77// allow quotient rings
78// of course allow modules
79
80namespace newf4 {
81
82// SPairType::Ring means between a ring element and GB element
83// SPairType::Exterior corresponds to the fact that variable * lead monomial = 0
84// SPairType::SPair means an SPair between 2 GB elements
85// SPairType::Gen means this SPair is one of the initial generators
86
87enum class SPairType { Ring, Exterior, SPair, Gen };
88
89struct SPair
90{
92 Index mFirst; // index in Basis itself. later in gb indexing.
95 // ComponentIndex mComponent; // component of the SPair (may not need this, as it matches comp of mLast/mFirst)
96 MonomialInt mDegree; // degree of the LCM
97 MonomialIndex mQuotient; // we might not need
98};
99
101{
102 public:
103 // What needs to be input here?
104 SPairSet() = default;
105
110 void updatePairs(const Basis& B, Index which);
111
112 // If we keep them sorted in increasing degree, we can
113 // grab the next set pretty easily. How to remove them?
114 auto getNextDegree() -> std::pair<MonomialInt, std::vector<SPair>>;
115 // or maybe have an iterator for it?
116 // we should make sure we don't "lose" those returned in case of interruption
117 // should be an iterator to avoid this and make it easier to loop over.
118 // also pass in a maximum number to return in a "chunk"
119
121
122 // sort in increasing degree, SPairType::Ring and SPairType::Exterior
123 // before SPairType::SPair before SPairType::Gen and in each degree by LCM?
124
125 private:
126 // std::vector<SPair> mSPairs;
127 // std::vector<std::vector<SPair>> mSPairsByDegree; ??
128
129 // the long here may not be actual degree, but a "sugar" degree
130 std::map<std::pair<long,SPairType>,std::vector<SPair>> mSPairsByDegree;
131};
132
133} // end namespace newf4
134
135// Local Variables:
136// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
137// indent-tabs-mode: nil
138// End:
newf4::Basis — evolving Gröbner basis container with GBPolyStatus per element.
Typed integer vocabulary for namespace newf4 (indices, monomial words, hashes, masks).
newf4::MonomialView — non-owning view over a [length, var_1, e_1, ...]-encoded monomial.
xxx xxx xxx
Definition ring.hpp:102
std::map< std::pair< long, SPairType >, std::vector< SPair > > mSPairsByDegree
Definition SPairs.hpp:130
auto getNextDegree() -> std::pair< MonomialInt, std::vector< SPair > >
SPairSet()=default
void updatePairs(const Basis &B, Index which)
int32_t Index
SPairType
Definition SPairs.hpp:87
int32_t MonomialIndex
int32_t MonomialInt
MonomialInt mDegree
Definition SPairs.hpp:96
MonomialIndex mLCM
Definition SPairs.hpp:94
SPairType mType
Definition SPairs.hpp:91
Index mLast
Definition SPairs.hpp:93
MonomialIndex mQuotient
Definition SPairs.hpp:97
Index mFirst
Definition SPairs.hpp:92