Macaulay2 Engine
Loading...
Searching...
No Matches
nc-res-computation.hpp
Go to the documentation of this file.
1/* Copyright 2014-2021, Michael E. Stillman */
2
3#ifndef _nc_res_computation_hpp_
4#define _nc_res_computation_hpp_
5
51
52#include "comp-res.hpp"
54#include "matrix.hpp"
55#include "matrix-con.hpp"
56
72{
73 private:
75 const Matrix& gbIdealMatrix,
76 int max_level);
77
78 public:
79 friend ResolutionComputation* createNCRes(const Matrix* groebnerBasisMatrix,
80 int max_level,
81 int strategy);
82
83 virtual ~NCResComputation() {}
84
85 protected:
86 // These functions override those in ResolutionComputation
88 {
89 // We ignore all stopping conditions except length_limit, degree_limit
90 return true;
91 }
92
94 std::cout << "Starting computation." << std::endl;
95 }
96
97 int complete_thru_degree() const { return 0; }
98 // The computation is complete up through this slanted degree.
99
100 const Matrix /* or null */* get_matrix(int level) {
101 if (level == 1) return &mInputModuleGB;
102 MatrixConstructor matCon(get_free(level-1), get_free(level));
103 return matCon.to_matrix();
104 }
105
106 MutableMatrix /* or null */* get_matrix(int slanted_degree, int level)
107 {
108 (void) slanted_degree;
109 (void) level;
110 return nullptr;
111 }
112
113 const FreeModule /* or null */* get_free(int level) {
114 if (level == 0) return mInputModuleGB.rows();
115 if (level == 1) return mInputModuleGB.cols();
116 return mInputModuleGB.get_ring()->make_FreeModule(0);
117 }
118
119 M2_arrayint get_betti(int type) const
120 {
121 (void) type;
122 return nullptr;
123 }
124 // type is documented under rawResolutionBetti, in engine.h
125
126 void text_out(buffer& o) const {
127 o << "Noncommutative resolution";
128 }
129
130 private:
131 // input information coming from M2 objects
133 //const Matrix& mInputIdealGB; // probably a computation type from a partial GB.
134 const Matrix& mInputModuleGB; // maybe not a GB of the module either...
136};
137
138#if 0
139// Data Types
140class NCSchreyerResolution
141{
142 // internal information for this resolution computation
143 std::vector<Level> mLevels;
144 MemoryBlock mMemoryBlock; // where all the monomials are stored
145 std::unordered_set<Monom> mAllMonomials; // or <int*>?
146};
147
148class Level
149{
150 std::vector<Element> mElements;
151 // SchreyerOrder at this level
152};
153
154class Element
155{
156 ModulePoly mPoly;
157 // degree
158 // component of previous step
159 // bool indicating that the element has been computed entirely?
160};
161
162class ModulePoly
163{
164 ElementArray mElementArray;
165 std::vector<int> mComponents;
166 std::vector<int> mMonomials;
167 // above could be std::vector of Monoms, or maybe even together
168 // a std::vector of a struct.
169};
170
171#endif
172
173// to create the frame:
174
175// 1. Fill in level 0 - (Take the degree information from the target mInputModGB)
176// 2. Fill in level 1 - (This is really just the info on the entries of mInputModGB)
177// This is more difficult the GB is not known out to that point yet.
178// 3. Fill in level 2 - This requires us to find all the spairs on module elements vs
179// elements of the ring Groebner basis
180// 4. Rinse and repeat.
181
182// detailed notes on a basic example
183// consider the right ideal (yyx,yxx)R with R = QQ<|x,y|>/(x*y - y*x)
184
185// Step 1:
186// level 0: right module generated by e_1
187
188// Step 2:
189// level 1: f_1 --> e_1yyx, f_2 --> e_1yxx
190
191// other gb elements? (e_1yyx) * y - (e_1 yy)*(x*y - y*x) = e_1 yyyx
192// (e_1yxx) * y - (e_1 yx)*(x*y - y*x) = e_1 yxyx ~> e_1yyxx - (e_1yyx)*x = 0
193
194// f_3 --> e_1 yyyx, etc (another f_j for each e_i y^j x for j >= 3)
195
196// Level 2:
197
198// g_1 --> f_1.y = e_1.yyx.y <~~> e_1.yyxy = e_1.yyyx, now have to add f_3 to level 1
199
200// g_1 --> f_1.y = e_1.yyx.y <~~> f_1.y - f_3 Claim: this element maps to zero under the previous map
201// g_1 will have label: e_1.yyx.y e_1yyxy - e_1yyyx = e_1yy.(xy - yx) = 0
202
203// g_2 --> f_2.y = e_1.yxx.y <~~> f_2.y - f_1.x e_1yxxy - e1yyxx = 0
204// g_2 will have label: e_1.yxx.y
205
206// g_3 --> f_3.y = e_1.yyyx.y <~~> f_3.y - f_4 (etc)
207// g_3 will have label: e_1.yyyx.y
208
209// for a term, we have: label - product of all leadTerms all the way back to level 0, e.g. e_1.yyyx.y (without the dots)
210
211// to compare
212// g_1.m_1; g_1 = f_1.v_1
213// g_2.m_2; g_2 = f_2.v_2, f_1 and f_2 are further back etc
214
215// first compare total monomials of g_1.m_1 and g_2.m_2. if there is a winner, take that term.
216// if there is a tie at this stage,
217
218// example:
219// level 0: e_1
220// level 1: f_1 = e_1.xy, f_2 = e_1.y^3, f_3 = e_1.yx
221// level 2: g_1 = f_1.xyy g_2 = f_1.xxy, g_3 = f_2.x
222
223// How to compare f_i.m and f_j.n: f_1.xxx vs f_2.xy
224// labels are e_1.xyxxx e_1.yyyxy (compare here). One is a winner.
225
226// Level 3:
227// we are done, because:
228// 1. All lead terms of images of g's are in different f components, and
229// 2. There are no overlaps with these lead terms with the ring.
230
231// level degree table:
232// degrees rows, levels columns (betti diagram in M2)
233// (entries indicate order of computation)
234
235// entries with the same letter may be computed at the same time
236
237/*
238 0 1 2 3 0 1 2 3
2390 a . . . pb pc (or *during*)
2401 . b c d
2412 . c d
2423 . d
243*/
244
245// creation of the frame
246// creation of level0and1 (translation of matrix to our information)
247// fillInSyzygies - fill in a level and degree of the frame.
248// F4 matrix creation and reduction code
249// take result in the frame and translate back
251 int max_level,
252 int strategy);
253
254#endif
255
256// Local Variables:
257// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
258// indent-tabs-mode: nil
259// End:
A FreeAlgebra modulo a two-sided ideal carried by an embedded NCGroebner.
Quotient of a FreeAlgebra by a Groebner basis up to a fixed degree bound.
Engine-side free module R^n over a Ring.
Definition freemod.hpp:66
Matrix * to_matrix()
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
Thin RAII wrapper around memtailor::Arena providing bump-pointer array allocation with optional mutex...
Abstract base class for mutable matrices over an arbitrary engine Ring, the in-place counterpart of t...
Definition mat.hpp:79
int complete_thru_degree() const
void text_out(buffer &o) const
const Matrix & mInputModuleGB
const Matrix * get_matrix(int level)
const FreeModule * get_free(int level)
MutableMatrix * get_matrix(int slanted_degree, int level)
friend ResolutionComputation * createNCRes(const Matrix *groebnerBasisMatrix, int max_level, int strategy)
M2_arrayint get_betti(int type) const
NCResComputation(const FreeAlgebraQuotient &ring, const Matrix &gbIdealMatrix, int max_level)
Base class for free resolution computation classes.
Definition comp-res.hpp:52
ResolutionComputation — abstract base for every free-resolution algorithm in the engine.
#define Matrix
Definition factory.cpp:14
MatrixConstructor — the mutable builder that produces an immutable Matrix.
Matrix — the engine's immutable homomorphism F -> G between free modules.
ResolutionComputation * createNCRes(const Matrix *m, int max_level, int strategy)