99 const VarIndex varCount = conf.varCount();
101 bool didSetComponentBefore =
false;
103 mgb::GroebnerConfiguration::RevLexDescendingBaseOrder;
105 std::vector<Exponent> gradings;
111 WerrorS(
"Unexpected negative block0/block1 in ring.");
116 const int*
const weights =
r->wvhdl[
block];
117 if (block0 > block1) {
118 WerrorS(
"Unexpected block0 > block1 in ring.");
124 if (block0 != 0 || block1 != 0 || weights != 0) {
125 WerrorS(
"Unexpected non-zero fields on c/C block in ring.");
128 if (didSetComponentBefore) {
129 WerrorS(
"Unexpected two c/C blocks in ring.");
132 didSetComponentBefore =
true;
134 conf.setComponentBefore
135 (mgb::GroebnerConfiguration::ComponentAfterBaseOrder);
137 conf.setComponentBefore(gradings.size() / varCount);
141 if (block0 == 0 || block1 == 0) {
142 WerrorS(
"Expected block0 != 0 and block1 != 0 in ring.");
145 if (block1 > varCount) {
147 WerrorS(
"Expected block1 <= #vars in ring.");
152 const size_t dim =
static_cast<size_t>(block1 - block0 + 1);
171 WerrorS(
"Block type a64 not supported for MathicGB interface.");
178 const bool wGrading =
181 if (oneGrading || minusOneGrading || wGrading || minusWGrading) {
182 const VarIndex begin = gradings.size();
183 gradings.resize(begin + varCount);
184 if (oneGrading || minusOneGrading) {
186 WerrorS(
"Expect wvhdl == 0 in Dp/dp/Ds/ds-block in ring.");
189 const Exponent value = oneGrading ? 1 : -1;
190 for (
int var = block0 - 1; var < block1; ++var)
191 gradings[begin + var] = value;
194 WerrorS(
"Expect wvhdl != 0 in a/Wp/wp/ws/Ws-block in ring.");
198 for (
int var = 0; var <
dim; ++var)
199 gradings[begin + (block0 - 1) + var] = weights[var];
201 for (
int var = 0; var <
dim; ++var)
202 gradings[begin + (block0 - 1) + var] = -weights[var];
210 const bool lexFromLeft =
218 const bool revlexFromRight =
224 if (lexFromLeft || lexFromRight || revlexFromLeft || revlexFromRight) {
231 baseOrder = mgb::GroebnerConfiguration::LexAscendingBaseOrder;
232 else if (revlexFromRight)
233 baseOrder = mgb::GroebnerConfiguration::RevLexDescendingBaseOrder;
234 else if (lexFromLeft)
235 baseOrder = mgb::GroebnerConfiguration::LexDescendingBaseOrder;
237 baseOrder = mgb::GroebnerConfiguration::RevLexAscendingBaseOrder;
241 const size_t begin = gradings.size();
242 gradings.resize(begin +
dim * varCount);
243 const Exponent value = (lexFromLeft || lexFromRight) ? 1 : -1;
244 if (lexFromLeft || revlexFromLeft) {
245 for (
size_t row = 0; row <
dim; ++row)
246 gradings[begin + row * varCount + (block0 - 1) + row] = value;
248 for (
size_t row = 0; row <
dim; ++row)
249 gradings[begin + row * varCount + (block1 - 1) - row] = value;
257 WerrorS(
"Expected wvhdl != 0 in M-block in ring.");
260 const size_t begin = gradings.size();
261 gradings.resize(begin +
dim * varCount);
262 for (
size_t row = 0; row <
dim; ++row)
263 for (
size_t col = block0 - 1; col < block1; ++col)
264 gradings[begin + row * varCount + col] = weights[row *
dim + col];
275 WerrorS(
"Schreyer order s/S/IS not supported in MathicGB interface.");
281 WerrorS(
"Block type am not supported in MathicGB interface");
285 WerrorS(
"Invalid L-block found in order of ring.");
290 WerrorS(
"aa ordering not supported by the MathicGB interface.");
294 WerrorS(
"Invalid unspec-block found in order of ring.");
297 WerrorS(
"Unknown block type found in order of ring.");
301 if (!didSetComponentBefore) {
302 WerrorS(
"Expected to find a c/C block in ring.");
306 if (!conf.setMonomialOrder(baseOrder, gradings)) {
307 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