Macaulay2 Engine
Loading...
Searching...
No Matches
gb-walk.hpp
Go to the documentation of this file.
1/* Copyright 2007, Michael E. Stillman */
2
3#ifndef _gb_walk_
4#define _gb_walk_
5
34
35#include "comp-gb.hpp"
36#include "engine-includes.hpp"
37#include "interface/monomial-ordering.h" // for MonomialOrdering
38#include "polyring.hpp"
39
40class Computation;
41class FreeModule;
42class GBRing;
43class MarkedGB;
44class Matrix;
45class RingElement;
46class buffer;
47
48struct POLY;
49struct gbvector;
50
56
57class GBWalker : public GBComputation
58{
59 const GBRing *R;
60 const FreeModule *F; // The free module containing the elements of the GB
61 MarkedGB *G; // This ends up being the answer...
62
63 VECTOR(M2_arrayint) w_history;
64
65 long **monorder1; // array 0..nvars-1 each of array 0..nvars-1
66 long **monorder2; // same
67
68 void initialize();
69
70 GBComputation *make_gb(const Matrix *M) const;
71
72 bool compute_next_w();
73
74 // local data in the computation (kept because of possible interrupts)
75 enum {
83 const Matrix *inwwG;
86 const Matrix *H;
87 VECTOR(gbvector *) leadterms;
88 VECTOR(POLY) polys;
89 MarkedGB *G1; // becomes G eventually
90 protected:
91 virtual bool stop_conditions_ok();
92
93 GBWalker(const Matrix *gb_under_order1, const MonomialOrdering *order1);
94
95 GBWalker(MarkedGB *G0, long **order1, long **order2);
96
97 public:
98 static GBWalker *create(MarkedGB *G0, long **order1, long **order2);
99
100 static GBWalker *create(const Matrix *gb_under_order1,
101 const MonomialOrdering *order1);
102
103 virtual ~GBWalker();
104
105 // GBComputation and Computation inherited routines //
106 virtual void remove_gb();
107
108 virtual void start_computation();
109
110 virtual const PolynomialRing *get_ring() const;
111
112 virtual Computation /* or null */ *set_hilbert_function(const RingElement *h);
113
114 virtual const Matrix /* or null */ *get_gb();
115
116 virtual const Matrix /* or null */ *get_mingens();
117
118 virtual const Matrix /* or null */ *get_change();
119
120 virtual const Matrix /* or null */ *get_syzygies();
121
122 virtual const Matrix /* or null */ *get_initial(int nparts);
123
124 virtual const Matrix /* or null */ *get_parallel_lead_terms(M2_arrayint w);
125
126 virtual const Matrix /* or null */ *matrix_remainder(const Matrix *m);
127
128 virtual M2_bool matrix_lift(const Matrix *m,
129 const Matrix /* or null */ **result_remainder,
130 const Matrix /* or null */ **result_quotient);
131
132 virtual int contains(const Matrix *m);
133
134 virtual void text_out(buffer &o) const;
135 /* This displays statistical information, and depends on the
136 M2_gbTrace value */
137
138 virtual int complete_thru_degree() const;
139 // The computation is complete up through this degree.
140
141 /* Debug display routines */
142 virtual void show() const;
144};
145
146#endif
147
148// Local Variables:
149// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
150// indent-tabs-mode: nil
151// End:
Computation()
Definition comp.cpp:40
Abstract base for long-running, resumable engine computations (GBComputation, ResolutionComputation,...
Definition comp.hpp:70
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
virtual void show() const
Definition gb-walk.cpp:295
virtual int complete_thru_degree() const
Definition gb-walk.cpp:302
GBComputation * make_gb(const Matrix *M) const
Definition gb-walk.cpp:102
virtual const Matrix * get_initial(int nparts)
Definition gb-walk.cpp:247
virtual const Matrix * get_mingens()
Definition gb-walk.cpp:229
MarkedGB * G1
Definition gb-walk.hpp:89
int next_to_reduce
Definition gb-walk.hpp:85
virtual ~GBWalker()
Definition gb-walk.cpp:91
GBComputation * gb_inwwG
Definition gb-walk.hpp:84
virtual const Matrix * get_parallel_lead_terms(M2_arrayint w)
Definition gb-walk.cpp:254
const FreeModule * F
Definition gb-walk.hpp:60
void show_mem_usage()
virtual const Matrix * get_change()
Definition gb-walk.cpp:235
long ** monorder2
Definition gb-walk.hpp:66
virtual bool stop_conditions_ok()
Definition gb-walk.cpp:96
virtual const Matrix * get_syzygies()
Definition gb-walk.cpp:241
GBWalker(const Matrix *gb_under_order1, const MonomialOrdering *order1)
Definition gb-walk.cpp:77
VECTOR(M2_arrayint) w_history
virtual M2_bool matrix_lift(const Matrix *m, const Matrix **result_remainder, const Matrix **result_quotient)
Definition gb-walk.cpp:268
MarkedGB * G
Definition gb-walk.hpp:61
void initialize()
Definition gb-walk.cpp:131
long ** monorder1
Definition gb-walk.hpp:65
const Matrix * H
Definition gb-walk.hpp:86
virtual void text_out(buffer &o) const
Definition gb-walk.cpp:287
virtual int contains(const Matrix *m)
Definition gb-walk.cpp:280
virtual void remove_gb()
Definition gb-walk.cpp:156
M2_arrayint ww
Definition gb-walk.hpp:82
virtual const Matrix * matrix_remainder(const Matrix *m)
Definition gb-walk.cpp:261
bool compute_next_w()
Definition gb-walk.cpp:143
virtual const Matrix * get_gb()
Definition gb-walk.cpp:223
static GBWalker * create(MarkedGB *G0, long **order1, long **order2)
virtual const PolynomialRing * get_ring() const
Definition gb-walk.cpp:210
@ STATE_reduce
Definition gb-walk.hpp:78
@ STATE_do_gb
Definition gb-walk.hpp:77
@ STATE_compute_w
Definition gb-walk.hpp:76
@ STATE_autoreduce
Definition gb-walk.hpp:79
@ STATE_done
Definition gb-walk.hpp:80
const Matrix * inwwG
Definition gb-walk.hpp:83
const GBRing * R
Definition gb-walk.hpp:59
virtual Computation * set_hilbert_function(const RingElement *h)
Definition gb-walk.cpp:216
virtual void start_computation()
Definition gb-walk.cpp:161
VECTOR(gbvector *) leadterms
VECTOR(POLY) polys
Computation of a reduced GB w.r.t. a marked ordering.
Abstract base for the engine's polynomial-ring hierarchy.
Definition polyring.hpp:96
Front-end-visible "ring element" value: an engine ring_elem paired with the Ring* that gives it meani...
Definition relem.hpp:67
GBComputation — abstract base of every Groebner-basis algorithm in the engine.
Engine-wide include prelude — a single point of truth for portability shims.
#define Matrix
Definition factory.cpp:14
char M2_bool
Definition m2-types.h:82
Engine-boundary C API for assembling block-level MonomialOrderings from declarative pieces.
#define POLY(q)
Definition poly.cpp:23
PolynomialRing — abstract polynomial-ring base, the engine's most-reused class.
static gmp_randstate_t state
Definition random.cpp:18
Front-end-side description of a monomial ordering as a list of mon_part blocks.