Macaulay2 Engine
Loading...
Searching...
No Matches

◆ choose_gb()

GBComputation * GBComputation::choose_gb ( const Matrix * m,
M2_bool collect_syz,
int n_rows_to_keep,
M2_arrayint gb_weights,
M2_bool use_max_degree,
int max_degree,
int algorithm,
int strategy,
int numThreads,
int max_reduction_count = 10 )
static

Definition at line 39 of file comp-gb.cpp.

49{
50 const Ring *R1 = m->get_ring();
51 const PolynomialRing *R2 = R1->cast_to_PolynomialRing();
52
53 std::vector<int> weights; // used in createParallelF4GB
54 if (R2 == nullptr)
55 {
56 // Look for the correct computation type here.
57 if (R1 == globalZZ)
58 {
59 return new HermiteComputation(m, collect_syz, n_rows_to_keep);
60 }
61 if (R1->is_field())
62 {
63 return new GaussElimComputation(m, collect_syz, n_rows_to_keep);
64 }
65#ifdef DEVELOPMENT
66#warning "handle non polynomial rings"
67#endif
68 ERROR("GB computation for non-polynomial rings not yet re-implemented");
69 return nullptr;
70 }
71
72// const PolynomialRing *R = R2->get_flattened_ring();
73// bool is_graded = (R->is_graded() && m->is_homogeneous());
74// bool ring_is_base = R->is_basic_ring();
75// bool base_is_ZZ = R->getCoefficientRing()->is_ZZ();
76#ifdef DEVELOPMENT
77#warning "NOT QUITE!! Need to know if it is ZZ or QQ"
78#warning "unused variables commented out"
79#endif
80 // bool base_is_field = !R->getCoefficientRing()->is_ZZ();
81
83
84 switch (algorithm)
85 {
86 case 4:
88 collect_syz,
89 n_rows_to_keep,
90 gb_weights,
91 strategy,
92 use_max_degree,
93 max_degree);
94 break;
95 case 5:
97 collect_syz,
98 n_rows_to_keep,
99 gb_weights,
100 strategy,
101 use_max_degree,
102 max_degree);
103 break;
104 case 6:
105 result = createF4GB(m,
106 collect_syz,
107 n_rows_to_keep,
108 gb_weights,
109 strategy,
110 use_max_degree,
111 max_degree,
112 numThreads);
113 break;
114 case 7:
116 collect_syz,
117 n_rows_to_keep,
118 gb_weights,
119 strategy,
120 use_max_degree,
121 max_degree);
122 break;
123 case 8:
124 ERROR("Algorithm => Test has been removed from M2");
125 return nullptr;
126 case 9:
127 // new GBF4 algorithm
128 weights = M2_arrayint_to_stdvector<int>(gb_weights);
130 weights,
131 strategy,
132 numThreads);
133 break;
134 default:
136 collect_syz,
137 n_rows_to_keep,
138 gb_weights,
139 strategy,
140 use_max_degree,
141 max_degree,
142 max_reduction_count);
143 break;
144 }
146 return result != nullptr ? new GBProxy(result) : nullptr;
147
148#if 0
149// if (is_graded)
150// return GB_comp::create(m,
151// collect_syz,
152// n_rows_to_keep,
153// strategy,
154// use_max_degree,
155// max_degree);
156//
157// return 0;
158#endif
159#if 0
160// if (base_is_ZZ)
161// {
162// if (ring_is_base)
163// {
164//
165// return HermiteComputation::create(m,
166// collect_syz,
167// collect_change,
168// n_rows_to_keep);
169// return 0;
170// }
171// // Question: should we separate between the graded, nongraded versions?
172// return GBZZ::create(m,
173// collect_syz,
174// collect_change,
175// n_rows_to_keep);
176// return 0;
177// }
178// else
179// {
180// // Base is a field
181// if (ring_is_base)
182// {
183// return GaussElimComputation::create(m,
184// collect_syz,
185// collect_change,
186// n_rows_to_keep);
187// // This should be fraction free
188// return 0;
189// }
190// // Also allow the user to choose between them.
191// if (is_graded)
192// return GB_comp::create(m,
193// collect_syz,
194// n_rows_to_keep,
195// strategy,
196// use_max_degree,
197// max_degree);
198// return GB_inhom_comp::create(m,
199// collect_syz,
200// collect_change,
201// n_rows_to_keep,
202// strategy);
203// return 0;
204// }
205#endif
206}
static GB_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)
friend class GBProxy
Definition comp-gb.hpp:71
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)
const Ring * get_ring() const
Definition matrix.hpp:134
bool is_field() const
Definition ring.cpp:68
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition ring.hpp:243
static binomialGB_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)
Definition gb-toric.cpp:993
static gbA * 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, int max_reduction_count)
GBComputation * createGBF4Interface(const Matrix *m, const std::vector< int > &weights, int strategy, int numThreads)
GBComputation * createF4GB(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, int numThreads)
void intern_GB(GBComputation *G)
Definition finalize.cpp:112
RingZZ * globalZZ
Definition relem.cpp:13
const int ERROR
Definition m2-mem.cpp:55
VALGRIND_MAKE_MEM_DEFINED & result(result)
std::vector< T > M2_arrayint_to_stdvector(M2_arrayint arr)
Definition util.hpp:96

References Ring::cast_to_PolynomialRing(), binomialGB_comp::create(), GB_comp::create(), gbA::create(), GBinhom_comp::create(), createF4GB(), createGBF4Interface(), ERROR, GBComputation(), GBProxy, Matrix::get_ring(), globalZZ, intern_GB(), Ring::is_field(), M2_arrayint_to_stdvector(), Matrix, and result().

Referenced by IM2_GB_make(), GBWalker::make_gb(), PolyRingQuotient::make_gb(), and PolyRingQuotient::syzygy().