110 const VarIndex varCount = conf.varCount();
112 bool didSetComponentBefore =
false;
114 mgb::GroebnerConfiguration::RevLexDescendingBaseOrder;
116 std::vector<Exponent> gradings;
122 if (r->block0[
block] < 0 || r->block1[
block] < 0)
124 WerrorS(
"Unexpected negative block0/block1 in ring.");
127 const VarIndex block0 = static_cast<VarIndex>(r->block0[
block]);
128 const VarIndex block1 = static_cast<VarIndex>(r->block1[
block]);
129 const int*
const weights = r->wvhdl[
block];
132 WerrorS(
"Unexpected block0 > block1 in ring.");
139 if (block0 != 0 || block1 != 0 || weights != 0)
141 WerrorS(
"Unexpected non-zero fields on c/C block in ring.");
144 if (didSetComponentBefore)
146 WerrorS(
"Unexpected two c/C blocks in ring.");
149 didSetComponentBefore =
true;
152 conf.setComponentBefore
153 (mgb::GroebnerConfiguration::ComponentAfterBaseOrder);
155 conf.setComponentBefore(gradings.size() / varCount);
159 if (block0 == 0 || block1 == 0)
161 WerrorS(
"Expected block0 != 0 and block1 != 0 in ring.");
164 if (block1 > varCount)
167 WerrorS(
"Expected block1 <= #vars in ring.");
172 const size_t dim = static_cast<size_t>(block1 - block0 + 1);
192 WerrorS(
"Block type a64 not supported for MathicGB interface.");
199 const bool wGrading =
202 if (oneGrading || minusOneGrading || wGrading || minusWGrading)
204 const VarIndex begin = gradings.size();
205 gradings.resize(begin + varCount);
206 if (oneGrading || minusOneGrading)
210 WerrorS(
"Expect wvhdl == 0 in Dp/dp/Ds/ds-block in ring.");
213 const Exponent value = oneGrading ? 1 : -1;
214 for (
int var = block0 - 1; var < block1; ++var)
215 gradings[begin + var] = value;
221 WerrorS(
"Expect wvhdl != 0 in a/Wp/wp/ws/Ws-block in ring.");
226 for (
int var = 0; var <
dim; ++var)
227 gradings[begin + (block0 - 1) + var] = weights[var];
231 for (
int var = 0; var <
dim; ++var)
232 gradings[begin + (block0 - 1) + var] = -weights[var];
240 const bool lexFromLeft =
248 const bool revlexFromRight =
254 if (lexFromLeft || lexFromRight || revlexFromLeft || revlexFromRight)
263 baseOrder = mgb::GroebnerConfiguration::LexAscendingBaseOrder;
264 else if (revlexFromRight)
265 baseOrder = mgb::GroebnerConfiguration::RevLexDescendingBaseOrder;
266 else if (lexFromLeft)
267 baseOrder = mgb::GroebnerConfiguration::LexDescendingBaseOrder;
269 baseOrder = mgb::GroebnerConfiguration::RevLexAscendingBaseOrder;
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)
278 for (
size_t row = 0; row <
dim; ++row)
279 gradings[begin + row * varCount + (block0 - 1) + row] = value;
283 for (
size_t row = 0; row <
dim; ++row)
284 gradings[begin + row * varCount + (block1 - 1) - row] = value;
294 WerrorS(
"Expected wvhdl != 0 in M-block in ring.");
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];
313 WerrorS(
"Schreyer order s/S/IS not supported in MathicGB interface.");
320 WerrorS(
"Block type am not supported in MathicGB interface");
325 WerrorS(
"Invalid L-block found in order of ring.");
331 WerrorS(
"aa ordering not supported by the MathicGB interface.");
336 WerrorS(
"Invalid unspec-block found in order of ring.");
339 WerrorS(
"Unknown block type found in order of ring.");
343 if (!didSetComponentBefore)
345 WerrorS(
"Expected to find a c/C block in ring.");
349 if (!conf.setMonomialOrder(baseOrder, gradings))
351 WerrorS(
"MathicGB does not support non-global orders.");
for idElimination, like a, except pFDeg, pWeigths ignore it
mgb::GroebnerConfiguration::VarIndex VarIndex
void WerrorS(const char *s)
mgb::GroebnerConfiguration::Exponent Exponent
Induced (Schreyer) ordering.
mgb::GroebnerConfiguration::BaseOrder BaseOrder