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

◆ find_exact()

MonomialTableZZ::mon_term * MonomialTableZZ::find_exact ( mpz_srcptr coeff,
exponents_t exp,
int comp ) const

Definition at line 325 of file montableZZ.cpp.

328{
329 if (comp >= static_cast<int>(_head.size())) return nullptr;
330 mon_term *head = _head[comp];
331 mon_term *t;
332 int i;
333
334 unsigned long expmask = monomial_mask(_nvars, exp);
335
336 for (t = head->_next; t != head; t = t->_next)
337 if (expmask == t->_mask)
338 {
339 bool is_eq = 1;
340 for (i = 0; i < _nvars; i++)
341 if (exp[i] != t->_lead[i])
342 {
343 is_eq = 0;
344 break;
345 }
346 if (is_eq && !mpz_cmp(coeff, t->_coeff)) return t;
347 }
348 return nullptr;
349}
static unsigned long monomial_mask(int nvars, exponents_t exp)
MonomialTable::mon_term plus an _coeff slot pointing at the entry's leading ZZ coefficient (or nullpt...

References MonomialTableZZ::mon_term::_coeff, MonomialTableZZ::mon_term::_lead, MonomialTableZZ::mon_term::_mask, MonomialTableZZ::mon_term::_next, _nvars, and monomial_mask().