Macaulay2 Engine
Loading...
Searching...
No Matches

◆ rawGRevLexMonomialOrdering()

MonomialOrdering * rawGRevLexMonomialOrdering ( M2_arrayint degs,
int packing )

Definition at line 552 of file monomial-ordering.cpp.

554{
556 mon_part p;
557 enum MonomialOrdering_type typ;
558 int *wts;
559 int all_one = 1;
560 unsigned int i;
561 for (i = 0; i < degs->len; i++)
562 if (degs->array[i] <= 0)
563 {
564 ERROR("grevlex: expected all degrees to be positive");
565 return nullptr;
566 }
567 else if (degs->array[i] > 1)
568 all_one = 0;
569
570 if (all_one)
571 {
572 if (packing == 2)
573 typ = MO_GREVLEX2;
574 else if (packing == 4)
575 typ = MO_GREVLEX4;
576 else
577 typ = MO_GREVLEX;
578 wts = nullptr;
579 }
580 else
581 {
582 if (packing == 2)
583 typ = MO_GREVLEX2_WTS;
584 else if (packing == 4)
585 typ = MO_GREVLEX4_WTS;
586 else
587 typ = MO_GREVLEX_WTS;
588 wts = degs->array;
589 }
590
591 p = mo_make(typ, degs->len, wts);
593 result->array[0] = p;
594 return result;
595}
int p
const int ERROR
Definition m2-mem.cpp:55
VALGRIND_MAKE_MEM_DEFINED & result(result)
static struct mon_part_rec_ * mo_make(enum MonomialOrdering_type type, int nvars, const int *wts)
static MonomialOrdering * make_mon_order(int n)
MonomialOrdering_type
@ MO_GREVLEX4_WTS
@ MO_GREVLEX
@ MO_GREVLEX4
@ MO_GREVLEX2_WTS
@ MO_GREVLEX2
@ MO_GREVLEX_WTS
Front-end-side description of a monomial ordering as a list of mon_part blocks.

References ERROR, make_mon_order(), MO_GREVLEX, MO_GREVLEX2, MO_GREVLEX2_WTS, MO_GREVLEX4, MO_GREVLEX4_WTS, MO_GREVLEX_WTS, mo_make(), p, result(), and mon_part::wts.

Referenced by TEST().