109{
110 const VarIndex varCount = conf.varCount();
111
112 bool didSetComponentBefore = false;
113 mgb::GroebnerConfiguration::BaseOrder baseOrder =
114 mgb::GroebnerConfiguration::RevLexDescendingBaseOrder;
115
116 std::vector<Exponent> gradings;
118 {
119
120
122 if (r->block0[
block] < 0 || r->block1[
block] < 0)
123 {
124 WerrorS(
"Unexpected negative block0/block1 in ring.");
125 return false;
126 }
129 const int*
const weights = r->wvhdl[
block];
130 if (block0 > block1)
131 {
132 WerrorS(
"Unexpected block0 > block1 in ring.");
133 return false;
134 }
135
136
138 {
139 if (block0 != 0 || block1 != 0 || weights != 0)
140 {
141 WerrorS(
"Unexpected non-zero fields on c/C block in ring.");
142 return false;
143 }
144 if (didSetComponentBefore)
145 {
146 WerrorS(
"Unexpected two c/C blocks in ring.");
147 return false;
148 }
149 didSetComponentBefore = true;
151 {
152 conf.setComponentBefore
153 (mgb::GroebnerConfiguration::ComponentAfterBaseOrder);
154 } else
155 conf.setComponentBefore(gradings.size() / varCount);
157 continue;
158 }
159 if (block0 == 0 || block1 == 0)
160 {
161 WerrorS(
"Expected block0 != 0 and block1 != 0 in ring.");
162 return false;
163 }
164 if (block1 > varCount)
165 {
166
167 WerrorS(
"Expected block1 <= #vars in ring.");
168 return false;
169 }
170
171
172 const size_t dim =
static_cast<size_t>(block1 - block0 + 1);
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
191 {
192 WerrorS(
"Block type a64 not supported for MathicGB interface.");
193 return false;
194 }
195
196
199 const bool wGrading =
202 if (oneGrading || minusOneGrading || wGrading || minusWGrading)
203 {
204 const VarIndex begin = gradings.size();
205 gradings.resize(begin + varCount);
206 if (oneGrading || minusOneGrading)
207 {
208 if (weights != 0)
209 {
210 WerrorS(
"Expect wvhdl == 0 in Dp/dp/Ds/ds-block in ring.");
211 return false;
212 }
213 const Exponent value = oneGrading ? 1 : -1;
214 for (int var = block0 - 1; var < block1; ++var)
215 gradings[begin + var] = value;
216 }
217 else
218 {
219 if (weights == 0)
220 {
221 WerrorS(
"Expect wvhdl != 0 in a/Wp/wp/ws/Ws-block in ring.");
222 return false;
223 }
224 if (wGrading)
225 {
226 for (
int var = 0; var <
dim; ++var)
227 gradings[begin + (block0 - 1) + var] = weights[var];
228 }
229 else
230 {
231 for (
int var = 0; var <
dim; ++var)
232 gradings[begin + (block0 - 1) + var] = -weights[var];
233 }
234 }
235 }
237 continue;
238
239
240 const bool lexFromLeft =
248 const bool revlexFromRight =
254 if (lexFromLeft || lexFromRight || revlexFromLeft || revlexFromRight)
255 {
260 if (final)
261 {
262 if (lexFromRight)
263 baseOrder = mgb::GroebnerConfiguration::LexAscendingBaseOrder;
264 else if (revlexFromRight)
265 baseOrder = mgb::GroebnerConfiguration::RevLexDescendingBaseOrder;
266 else if (lexFromLeft)
267 baseOrder = mgb::GroebnerConfiguration::LexDescendingBaseOrder;
268 else
269 baseOrder = mgb::GroebnerConfiguration::RevLexAscendingBaseOrder;
270 continue;
271 }
272
273 const size_t begin = gradings.size();
274 gradings.resize(begin +
dim * varCount);
275 const Exponent value = (lexFromLeft || lexFromRight) ? 1 : -1;
276 if (lexFromLeft || revlexFromLeft)
277 {
278 for (
size_t row = 0; row <
dim; ++row)
279 gradings[begin + row * varCount + (block0 - 1) + row] = value;
280 }
281 else
282 {
283 for (
size_t row = 0; row <
dim; ++row)
284 gradings[begin + row * varCount + (block1 - 1) - row] = value;
285 }
286 continue;
287 }
288
289
291 {
292 if (weights == 0)
293 {
294 WerrorS(
"Expected wvhdl != 0 in M-block in ring.");
295 return false;
296 }
297 const size_t begin = gradings.size();
298 gradings.resize(begin +
dim * varCount);
299 for (
size_t row = 0; row <
dim; ++row)
300 for (size_t col = block0 - 1; col < block1; ++col)
301 gradings[begin + row * varCount + col] = weights[row *
dim + col];
302 continue;
303 }
304
305
306 if (
310 )
311 {
312
313 WerrorS(
"Schreyer order s/S/IS not supported in MathicGB interface.");
314 return false;
315 }
317 {
318
319
320 WerrorS(
"Block type am not supported in MathicGB interface");
321 return false;
322 }
324 {
325 WerrorS(
"Invalid L-block found in order of ring.");
326 return false;
327 }
329 {
330
331 WerrorS(
"aa ordering not supported by the MathicGB interface.");
332 return false;
333 }
335 {
336 WerrorS(
"Invalid unspec-block found in order of ring.");
337 return false;
338 }
339 WerrorS(
"Unknown block type found in order of ring.");
340 return false;
341 }
342
343 if (!didSetComponentBefore)
344 {
345 WerrorS(
"Expected to find a c/C block in ring.");
346 return false;
347 }
348
349 if (!conf.setMonomialOrder(baseOrder, gradings))
350 {
351 WerrorS(
"MathicGB does not support non-global orders.");
352 return false;
353 }
354 return true;
355}
mgb::GroebnerConfiguration::Exponent Exponent
mgb::GroebnerConfiguration::VarIndex VarIndex