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

◆ divide()

bool MonomialInfo::divide ( const_packed_monomial m,
const_packed_monomial n,
packed_monomial result ) const
inline

Definition at line 380 of file moninfo.hpp.

383 {
385 // First, divide monomials
386 // Then, if the division is OK, set the component, hash value and rest of
387 // the monomial
388 if (m[1] != n[1]) // components are not equal
389 return false;
392 packed_monomial result1 = result + nslots;
393 for (int i = nslots - 2; i > 0; i--)
394 {
395 varpower_word cmp = *--m1 - *--n1;
396 if (cmp < 0) return false;
397 *--result1 = cmp;
398 }
399 result[1] = 0; // the component of a division is in the ring (comp 0).
400 result[0] = m[0] - n[0]; // subtract hash codes
401 return true;
402 }
unsigned long ncalls_divide
Definition moninfo.hpp:141
VALGRIND_MAKE_MEM_DEFINED & result(result)
monomial_word * packed_monomial
Definition moninfo.hpp:78
const monomial_word * const_packed_monomial
Definition moninfo.hpp:79
varpower_monomials::Exponent varpower_word

References ncalls_divide, nslots, and result().