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

◆ monomialDivides()

bool newf4::MonomialView::monomialDivides ( const MonomialView & divisor,
const MonomialView & divisee )
inlinestatic

Definition at line 87 of file MonomialView.hpp.

89 {
90 if (divisor.size() > divisee.size()) return false;
91 auto divisorIt = divisor.begin();
92 auto diviseeIt = divisee.begin();
93 auto divisorEnd = divisor.end();
94 auto diviseeEnd = divisee.end();
95 while (divisorIt != divisorEnd)
96 {
97 auto divisorVar = divisorIt.var();
98 while (true)
99 {
100 if (diviseeIt == diviseeEnd) return false;
101 if (diviseeIt.var() > divisorVar) return false;
102 if (diviseeIt.var() == divisorVar) break;
103 ++diviseeIt;
104 }
105 // at this point, both diviseeIt.var() and divisorIt.var() are equal
106 if (divisorIt.power() > diviseeIt.power()) return false;
107 ++divisorIt;
108 ++diviseeIt;
109 }
110 return true;
111 }

References begin(), end(), MonomialView(), and size().

Referenced by newf4::MonomialLookupTable::findAllDivisees(), newf4::MonomialLookupTable::findAllDivisors(), and TEST().