100 const VarIndex varCount = conf.varCount();
102 bool didSetComponentBefore =
false;
104 mgb::GroebnerConfiguration::RevLexDescendingBaseOrder;
106 std::vector<Exponent> gradings;
111 if (r->block0[
block] < 0 || r->block1[
block] < 0) {
112 WerrorS(
"Unexpected negative block0/block1 in ring.");
115 const VarIndex block0 = static_cast<VarIndex>(r->block0[
block]);
116 const VarIndex block1 = static_cast<VarIndex>(r->block1[
block]);
117 const int*
const weights = r->wvhdl[
block];
118 if (block0 > block1) {
119 WerrorS(
"Unexpected block0 > block1 in ring.");
125 if (block0 != 0 || block1 != 0 || weights != 0) {
126 WerrorS(
"Unexpected non-zero fields on c/C block in ring.");
129 if (didSetComponentBefore) {
130 WerrorS(
"Unexpected two c/C blocks in ring.");
133 didSetComponentBefore =
true;
135 conf.setComponentBefore
136 (mgb::GroebnerConfiguration::ComponentAfterBaseOrder);
138 conf.setComponentBefore(gradings.size() / varCount);
142 if (block0 == 0 || block1 == 0) {
143 WerrorS(
"Expected block0 != 0 and block1 != 0 in ring.");
146 if (block1 > varCount) {
148 WerrorS(
"Expected block1 <= #vars in ring.");
153 const size_t dim = static_cast<size_t>(block1 - block0 + 1);
172 WerrorS(
"Block type a64 not supported for MathicGB interface.");
179 const bool wGrading =
182 if (oneGrading || minusOneGrading || wGrading || minusWGrading) {
183 const VarIndex begin = gradings.size();
184 gradings.resize(begin + varCount);
185 if (oneGrading || minusOneGrading) {
187 WerrorS(
"Expect wvhdl == 0 in Dp/dp/Ds/ds-block in ring.");
190 const Exponent value = oneGrading ? 1 : -1;
191 for (
int var = block0 - 1; var < block1; ++var)
192 gradings[begin + var] = value;
195 WerrorS(
"Expect wvhdl != 0 in a/Wp/wp/ws/Ws-block in ring.");
199 for (
int var = 0; var <
dim; ++var)
200 gradings[begin + (block0 - 1) + var] = weights[var];
202 for (
int var = 0; var <
dim; ++var)
203 gradings[begin + (block0 - 1) + var] = -weights[var];
211 const bool lexFromLeft =
219 const bool revlexFromRight =
225 if (lexFromLeft || lexFromRight || revlexFromLeft || revlexFromRight) {
232 baseOrder = mgb::GroebnerConfiguration::LexAscendingBaseOrder;
233 else if (revlexFromRight)
234 baseOrder = mgb::GroebnerConfiguration::RevLexDescendingBaseOrder;
235 else if (lexFromLeft)
236 baseOrder = mgb::GroebnerConfiguration::LexDescendingBaseOrder;
238 baseOrder = mgb::GroebnerConfiguration::RevLexAscendingBaseOrder;
242 const size_t begin = gradings.size();
243 gradings.resize(begin +
dim * varCount);
244 const Exponent value = (lexFromLeft || lexFromRight) ? 1 : -1;
245 if (lexFromLeft || revlexFromLeft) {
246 for (
size_t row = 0; row <
dim; ++row)
247 gradings[begin + row * varCount + (block0 - 1) + row] = value;
249 for (
size_t row = 0; row <
dim; ++row)
250 gradings[begin + row * varCount + (block1 - 1) - row] = value;
258 WerrorS(
"Expected wvhdl != 0 in M-block in ring.");
261 const size_t begin = gradings.size();
262 gradings.resize(begin +
dim * varCount);
263 for (
size_t row = 0; row <
dim; ++row)
264 for (
size_t col = block0 - 1; col < block1; ++col)
265 gradings[begin + row * varCount + col] = weights[row *
dim + col];
276 WerrorS(
"Schreyer order s/S/IS not supported in MathicGB interface.");
282 WerrorS(
"Block type am not supported in MathicGB interface");
286 WerrorS(
"Invalid L-block found in order of ring.");
291 WerrorS(
"aa ordering not supported by the MathicGB interface.");
295 WerrorS(
"Invalid unspec-block found in order of ring.");
298 WerrorS(
"Unknown block type found in order of ring.");
302 if (!didSetComponentBefore) {
303 WerrorS(
"Expected to find a c/C block in ring.");
307 if (!conf.setMonomialOrder(baseOrder, gradings)) {
308 WerrorS(
"MathicGB does not support non-global orders.");