19 for (
auto i = 0; i < mo->nvars; ++i)
20 result.push_back(mo->is_laurent[i] == 1);
54 b->
nslots = (nvars + 1) / 2;
65 b->
nslots = (nvars + 3) / 4;
87 b->
nslots = (nvars + 1) / 2;
98 b->
nslots = (nvars + 3) / 4;
120 b->
nslots = (nvars + 1) / 2;
131 b->
nslots = (nvars + 3) / 4;
174 int i, j, nv, this_block;
175 deg_t *wts =
nullptr;
180 int hascomponent = 0;
181 for (i = 0; i < mo->
len; i++)
193 nblocks -= hascomponent;
199 result->nblocks = nblocks;
203 if (hascomponent == 0)
result->nblocks_before_component = nblocks;
207 for (i = 0; i < mo->
len; i++)
212 if (t->
wts ==
nullptr)
258 result->blocks + this_block++,
272 if (--hascomponent == 0)
276 result->nblocks_before_component = this_block;
281 if (--hascomponent == 0)
285 result->nblocks_before_component = this_block;
297 result->nslots_before_component = 0;
298 for (i = 0; i < nblocks; i++)
302 result->blocks[i].first_exp = nv;
304 nv +=
result->blocks[i].nvars;
309 result->blocks[i].first_exp = 0;
312 for (j = 0; j <
result->blocks[i].nvars; j++)
319 result->blocks[i].weights =
323 if (i ==
result->nblocks_before_component - 1)
331 for (i = 0; i <
result->nvars; i++)
result->is_laurent[i] = 0;
333 for (i = 0; i <
result->nblocks; i++)
337 for (j = 0; j <
result->blocks[i].nvars; j++)
338 result->is_laurent[
result->blocks[i].first_exp + j] = 1;
348 if (
nvars == 0)
return;
352 if (--
nvars == 0)
break;
354 if (--
nvars == 0)
break;
356 if (--
nvars == 0)
break;
358 if (--
nvars == 0)
break;
367 if (
nvars == 0)
return;
371 if (--
nvars == 0)
break;
373 if (--
nvars == 0)
break;
382 if (
nvars == 0)
return;
386 *expon++ = (i >> 24);
387 if (--
nvars == 0)
break;
388 *expon++ = (i >> 16) & 0x7f;
389 if (--
nvars == 0)
break;
390 *expon++ = (i >> 8) & 0x7f;
391 if (--
nvars == 0)
break;
393 if (--
nvars == 0)
break;
400 if (
nvars == 0)
return;
405 if (--
nvars == 0)
break;
406 *expon++ = i & 0x7fff;
407 if (--
nvars == 0)
break;
416 if (mo ==
nullptr)
return;
417 int *tmpexp =
static_cast<int *
>(alloca((mo->nvars + 1) *
sizeof(
int)));
422 int nblocks = mo->nblocks;
423 const int *e = expon;
424 int *
p = result_psums;
425 for (i = nblocks; i > 0; --i, b++)
switch (b->
typ)
430 for (j = 0; j <
nvars; j++) *
p++ = *e++;
442 for (j = 1; j <
nvars; j++)
454 for (j = 1; j <
nvars; j++)
465 for (j = 1; j <
nvars; j++)
478 for (j = 1; j <
nvars; j++)
491 for (j = 1; j <
nvars; j++)
504 for (j = 1; j <
nvars; j++)
552 if (mo ==
nullptr)
return;
553 int *tmpexp =
static_cast<int *
>(alloca((mo->nvars + 1) *
sizeof(
int)));
555 deg_t *degs = mo->degs;
558 int nblocks = mo->nblocks;
560 const int *
p = psums;
561 for (i = nblocks; i > 0; --i, b++)
switch (b->
typ)
568 for (j = 0; j <
nvars; j++) *e++ = *
p++;
590 for (j =
nvars - 1; j >= 1; --j, --
p)
608 for (j =
nvars - 1; j >= 1; --j, --
p)
626 for (j =
nvars - 1; j >= 1; --j, --
p)
exponents::ConstExponents const_exponents
exponents::Exponents exponents_t
Dense exponent-vector template [e_0, ..., e_{nvars-1}] for monomial operations.
Engine-wide include prelude — a single point of truth for portability shims.
static void MO_pack4(int nvars, const int *expon, int *slots)
std::vector< bool > laurentVariables(const MonomialOrder *mo)
static void mo_block_grevlex4(struct mo_block *b, int nvars)
static void mo_block_grevlex2_wts(struct mo_block *b, int nvars)
static void mo_block_group_lex(struct mo_block *b, int nvars)
void monomialOrderEncodeFromActualExponents(const MonomialOrder *mo, const_exponents expon, monomial result_psums)
MonomialOrder * monomialOrderMake(const MonomialOrdering *mo)
static void mo_block_group_revlex(struct mo_block *b, int nvars)
void monomialOrderFree(MonomialOrder *mo)
void monomialOrderDecodeToActualExponents(const MonomialOrder *mo, const_monomial psums, exponents_t expon)
static void MO_pack2(int nvars, const int *expon, int *slots)
static void mo_block_grevlex4_wts(struct mo_block *b, int nvars)
static void MO_unpack4(int nvars, const int *slots, int *expon)
static void mo_block_grevlex2(struct mo_block *b, int nvars)
static void mo_block_grevlex_wts(struct mo_block *b, int nvars)
static void mo_block_grevlex(struct mo_block *b, int nvars)
static void mo_block_revlex(struct mo_block *b, int nvars)
static void mo_block_lex4(struct mo_block *b, int nvars)
static void mo_block_wt_function(struct mo_block *b, int nvars, deg_t *wts)
static void mo_block_lex2(struct mo_block *b, int nvars)
static void MO_unpack2(int nvars, const int *slots, int *expon)
static void mo_block_lex(struct mo_block *b, int nvars)
const int * const_monomial
Internal (runtime) form of a monomial ordering.
char * getmem_atomic(size_t n)
VALGRIND_MAKE_MEM_DEFINED & result(result)
#define getmemstructtype(S)
static int32_t mult(int32_t x, int32_t y, const char *msg)
static int32_t div_by(int32_t &x, int32_t y, const char *msg)
static int32_t add(int32_t x, int32_t y, const char *msg)
static int32_t fits_7(int32_t x, const char *msg)
static int32_t sub(int32_t x, int32_t y, const char *msg)
static int32_t fits_15(int32_t x, const char *msg)
static int32_t minus(int32_t x, const char *msg)
Overflow-checked integer arithmetic for monomial exponents and degree sums.
Front-end-side description of a monomial ordering as a list of mon_part blocks.
enum MonomialOrdering_type typ
enum MonomialOrdering_type type