Macaulay2 Engine
Loading...
Searching...
No Matches
gb-sugarless.hpp
Go to the documentation of this file.
1// Copyright 1996 Michael E. Stillman
2#ifndef _gbinhom_hh_
3#define _gbinhom_hh_
4
38
39#include "relem.hpp"
40#include "matrix.hpp"
41#include "polyring.hpp"
42#include "comp-gb.hpp"
43#include "reducedgb.hpp"
44
45#include "spair.hpp"
46#include "matrix-con.hpp"
47class GBWeight;
48
59{
60 private:
61 // Ring information
65 const Monoid *M; // flattened monomials
66 const Ring *K; // flattened coefficients
67
68 const FreeModule *F;
70
72
73 gb_elem *gb; // The minimal GB so far encountered
74 // This is a list with a dummy head.
75
77
80
81 VECTOR(MonomialIdeal *) monideals; // baggage for each is 'gb_elem *'
82 // This is the 'large' GB
83
84 // Syzygies collected
86
87 // statistics information
88 int n_gb;
89 int n_syz;
96
97 // Syzygy type
98 int collect_syz; // 0 or 1
102
104
105 private:
106 void set_up0(const Matrix *m, int csyz, int nsyz, M2_arrayint gb_weights);
107 void set_up(const Matrix *m,
108 int csyz,
109 int nsyz,
110 M2_arrayint gb_weights,
111 int strategy);
112
113 // S-pair control
114 s_pair *new_var_pair(gb_elem *p, const int *lcm);
115 s_pair *new_ring_pair(gb_elem *p, const int *lcm);
116 s_pair *new_s_pair(gb_elem *p, gb_elem *q, const int *lcm);
117 s_pair *new_gen(int i, gbvector *f, ring_elem denom);
118 void remove_pair(s_pair *&p);
119 int mark_pair(gb_elem *p, gb_elem *q) const;
120
121 int search(const int *exp, int comp, gb_elem *&result);
122 int compare(const gb_elem *p, const gb_elem *q) const;
123 void find_pairs(gb_elem *p);
124 void compute_s_pair(s_pair *p);
125 int gb_reduce(gbvector *&f, gbvector *&fsyz);
126 int gb_geo_reduce(gbvector *&f, gbvector *&fsyz);
127 void gb_insert(gbvector *f, gbvector *fsyz, int minlevel);
128 void inter_reduce(gb_elem *&gens);
129
131
132 int s_pair_step(s_pair *p);
133
134 void resize(int nbits);
135
136 void minimalize_gb();
137
138 public:
139 // An honest GB computation
140 GBinhom_comp(const Matrix *m,
141 int collect_syz,
142 int n_syz,
143 M2_arrayint gb_weights,
144 int strategy);
146
147 virtual void remove_gb() {}
148 // Performing the computation
149 int calc(const int *deg, const gc_vector<int>& stop_conditions);
150
151 // Adding generators
152 void add_gens(int lo, int hi, const Matrix *m);
153
154 // reduction
155 Matrix *reduce(const Matrix *m, Matrix *&lift);
156
157 // obtaining: mingens matrix, GB matrix, change of basis matrix, stats.
163 void debug_out(s_pair *q) const;
164 void debug_pairs_out(gb_elem *p) const;
165 void debug_pairs() const;
166 void debug_out(buffer &o, s_pair *q) const;
167 void debug_pairs_out(buffer &o, gb_elem *p) const;
168 void debug_pairs(buffer &o) const;
169
170 void stats() const;
171
173 // Computation routines //
175 virtual bool stop_conditions_ok() { return true; }
176 static GBinhom_comp *create(const Matrix *m,
178 int n_rows_to_keep,
179 M2_arrayint gb_weights,
180 int strategy,
181 M2_bool use_max_degree,
182 int max_degree);
183
184 virtual int kind() { return 232; } // FIX THIS!!
185 void start_computation();
186
187 virtual const PolynomialRing *get_ring() const { return originalR; }
188 virtual const Matrix /* or null */ *get_gb();
189
190 virtual const Matrix /* or null */ *get_mingens();
191
192 virtual const Matrix /* or null */ *get_change();
193
194 virtual const Matrix /* or null */ *get_syzygies();
195
196 virtual const Matrix /* or null */ *get_initial(int nparts);
197
198 virtual const Matrix /* or null */ *get_parallel_lead_terms(M2_arrayint w);
199
200 virtual const Matrix /* or null */ *matrix_remainder(const Matrix *m);
201
202 virtual M2_bool matrix_lift(const Matrix *m,
203 const Matrix /* or null */ **result_remainder,
204 const Matrix /* or null */ **result_quotient);
205
206 virtual int contains(const Matrix *m);
207
208 virtual void text_out(buffer &o) const;
209 /* This displays statistical information, and depends on the
210 M2_gbTrace value */
211
212 virtual int complete_thru_degree() const;
213 // The computation is complete up through this degree.
214};
215#endif
216
217// Local Variables:
218// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
219// indent-tabs-mode: nil
220// End:
Engine-side free module R^n over a Ring.
Definition freemod.hpp:66
Polynomial-ring view tuned for the inner loop of classical Buchberger Groebner-basis computations.
Definition gbring.hpp:120
Heuristic-weight evaluator for gbvectors, used during Groebner basis computation to drive the S-pair ...
Definition gbweight.hpp:67
void find_pairs(gb_elem *p)
void inter_reduce(gb_elem *&gens)
void add_gens(int lo, int hi, const Matrix *m)
void resize(int nbits)
virtual const Matrix * get_syzygies()
virtual void remove_gb()
int compare(const gb_elem *p, const gb_elem *q) const
const Ring * K
virtual M2_bool matrix_lift(const Matrix *m, const Matrix **result_remainder, const Matrix **result_quotient)
int mark_pair(gb_elem *p, gb_elem *q) const
Matrix * min_gens_matrix()
gb_elem * gbLarge
virtual const Matrix * matrix_remainder(const Matrix *m)
virtual int contains(const Matrix *m)
void gb_insert(gbvector *f, gbvector *fsyz, int minlevel)
const FreeModule * Fsyz
Matrix * syz_matrix()
const FreeModule * F
virtual void text_out(buffer &o) const
virtual int complete_thru_degree() const
void compute_s_pair(s_pair *p)
s_pair * new_ring_pair(gb_elem *p, const int *lcm)
virtual const Matrix * get_initial(int nparts)
Matrix * gb_matrix()
void debug_pairs_out(gb_elem *p) const
int gb_geo_reduce(gbvector *&f, gbvector *&fsyz)
int gb_reduce(gbvector *&f, gbvector *&fsyz)
static GBinhom_comp * create(const Matrix *m, M2_bool collect_syz, int n_rows_to_keep, M2_arrayint gb_weights, int strategy, M2_bool use_max_degree, int max_degree)
MatrixConstructor syz
GBinhom_comp(const Matrix *m, int collect_syz, int n_syz, M2_arrayint gb_weights, int strategy)
virtual const PolynomialRing * get_ring() const
ReducedGB * minimal_gb
s_pair_heap * spairs
virtual const Matrix * get_parallel_lead_terms(M2_arrayint w)
int calc(const int *deg, const gc_vector< int > &stop_conditions)
GBWeight * weightInfo_
void debug_pairs() const
void set_up(const Matrix *m, int csyz, int nsyz, M2_arrayint gb_weights, int strategy)
virtual const Matrix * get_change()
VECTOR(MonomialIdeal *) monideals
void stats() const
void remove_pair(s_pair *&p)
virtual int kind()
s_pair * new_s_pair(gb_elem *p, gb_elem *q, const int *lcm)
const Monoid * M
virtual const Matrix * get_gb()
void start_computation()
s_pair * new_var_pair(gb_elem *p, const int *lcm)
int search(const int *exp, int comp, gb_elem *&result)
virtual const Matrix * get_mingens()
void debug_out(s_pair *q) const
virtual bool stop_conditions_ok()
ComputationStatusCode computation_complete() const
int s_pair_step(s_pair *p)
Matrix * reduce(const Matrix *m, Matrix *&lift)
void set_up0(const Matrix *m, int csyz, int nsyz, M2_arrayint gb_weights)
Matrix * change_matrix()
const PolynomialRing * originalR
s_pair * new_gen(int i, gbvector *f, ring_elem denom)
Matrix * initial_matrix(int n)
A Groebner basis computation class for inhomogeneous input modules.
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
Definition monoid.hpp:89
Engine-side monomial ideal: a decision tree of Nmi_nodes storing the (typically minimal) generators b...
Definition monideal.hpp:136
Abstract base for the engine's polynomial-ring hierarchy.
Definition polyring.hpp:96
Base class for reduced Groebner basis computation.
Definition reducedgb.hpp:62
xxx xxx xxx
Definition ring.hpp:102
GBComputation — abstract base of every Groebner-basis algorithm in the engine.
ComputationStatusCode
Definition computation.h:53
#define Matrix
Definition factory.cpp:14
int p
VALGRIND_MAKE_MEM_DEFINED & result(result)
char M2_bool
Definition m2-types.h:82
MatrixConstructor — the mutable builder that produces an immutable Matrix.
Matrix — the engine's immutable homomorphism F -> G between free modules.
typename std::vector< T, gc_allocator< T > > gc_vector
a version of the STL vector, which allocates its backing memory with gc.
Definition newdelete.hpp:76
PolynomialRing — abstract polynomial-ring base, the engine's most-reused class.
ReducedGB — abstract base for the canonicalising reduction pass that follows GB computation.
RingElement — tagged (Ring*, ring_elem) pair, the engine's universal element type.
gb_elem / s_pair / s_pair_heap — basis-element record, S-pair work unit, and S-pair priority queue fo...