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

◆ divides()

bool Monoid::divides ( const_monomial m,
const_monomial n ) const

Definition at line 493 of file monoid.cpp.

495{
496 if (mVariableCount == 0) return true;
497
500 // can we speed this up by not unpacking ??
501 to_expvector(m, EXP1);
502 to_expvector(n, EXP2);
503 if (numInvertibleVariables() == 0)
504 return exponents::divides(mVariableCount, EXP1, EXP2);
505 for (int i = 0; i < mVariableCount; ++i)
506 if (not mLaurentVariablesPredicate[i] and EXP1[i] > EXP2[i])
507 return false;
508 return true;
509}
exponents::Exponents exponents_t
static bool divides(int nvars, ConstExponents a, ConstExponents b)
void to_expvector(const_monomial m, exponents_t result_exp) const
Definition monoid.cpp:747
std::vector< bool > mLaurentVariablesPredicate
These are the variables which can have negative exponents.
Definition monoid.hpp:140
size_t exp_size
Definition monoid.hpp:120
const int mVariableCount
number of variables
Definition monoid.hpp:99
int numInvertibleVariables() const
Definition monoid.hpp:189
#define ALLOCATE_EXPONENTS(byte_len)
Definition monoid.hpp:62

References ALLOCATE_EXPONENTS, ExponentVector< int, true >::divides(), exp_size, mLaurentVariablesPredicate, mVariableCount, numInvertibleVariables(), and to_expvector().

Referenced by EngineMonomial::divides().