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

◆ compare()

int SPolySorter::compare ( value a,
value b )
inline

Definition at line 748 of file gb-default.cpp.

749 {
750 // returns: LT if a < b, EQ if a == b, GT if a > b.
751 /* Compare using degree, then type, then lead term of spoly */
752 int result;
753 int cmp = a->deg - b->deg;
754 if (cmp < 0)
755 result = GT;
756 else if (cmp > 0)
757 result = LT;
758 else
759 {
760 gbvector *a1 =
761 (a->type > gbA::SPAIR::SPAIR_SKEW ? a->f() : a->lead_of_spoly);
762 gbvector *b1 =
763 (b->type > gbA::SPAIR::SPAIR_SKEW ? b->f() : b->lead_of_spoly);
764 if (a1 == nullptr)
765 {
766 if (b1 == nullptr)
767 result = EQ;
768 else
769 result = LT;
770 }
771 else
772 {
773 if (!b1)
774 result = GT;
775 else
776 result = R->gbvector_compare(F, a1, b1);
777 }
778 }
779 return result;
780 }
const FreeModule * F
@ SPAIR_SKEW
VALGRIND_MAKE_MEM_DEFINED & result(result)
const int EQ
Definition style.hpp:40
const int GT
Definition style.hpp:41
const int LT
Definition style.hpp:39

References gbA::spair::deg, EQ, F, gbA::spair::f, GT, gbA::spair::lead_of_spoly, LT, R, result(), gbA::SPAIR_SKEW, and gbA::spair::type.

Referenced by operator()().