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

◆ find_good_monomial_divisor_ZZ()

int gbA::find_good_monomial_divisor_ZZ ( mpz_srcptr c,
exponents_t e,
int x,
int degf,
int & result_gap )
private

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

1611{
1612 // Get all of the term divisors.
1613 // Choose one with the smallest gap.
1614 int i, gap, newgap, egap;
1615 int n = 0;
1616
1617 (void) c;
1618 VECTOR(MonomialTableZZ::mon_term *) divisors;
1619 egap = degf - weightInfo_->exponents_weight(e, x);
1620
1621 /* First search for ring divisors */
1622 if (ringtableZZ)
1623 n += ringtableZZ->find_monomial_divisors(-1, e, 1, &divisors);
1624
1625 /* Next search for GB divisors */
1626 n += lookupZZ->find_monomial_divisors(-1, e, x, &divisors);
1627
1628 /* Now find the minimal gap value */
1629 if (n == 0) return -1;
1630 int result = divisors[0]->_val;
1631 gbelem *tg = gb[result];
1632 gap = tg->gap - egap;
1633 if (gap <= 0)
1634 gap = 0;
1635 else
1636 for (i = 1; i < n; i++)
1637 {
1638 int new_val = divisors[i]->_val;
1639 tg = gb[new_val];
1640 newgap = tg->gap - egap;
1641 if (newgap <= 0)
1642 {
1643 gap = 0;
1644 result = new_val;
1645 break;
1646 }
1647 else if (newgap < gap)
1648 {
1649 result = new_val;
1650 gap = newgap;
1651 }
1652 }
1653 result_gap = gap;
1654 return result;
1655}
MonomialTableZZ * lookupZZ
const GBWeight * weightInfo_
const MonomialTableZZ * ringtableZZ
void gb(IntermediateBasis &F, int n)
VALGRIND_MAKE_MEM_DEFINED & result(result)
#define VECTOR(T)
Definition newdelete.hpp:78
volatile int x

References gbA::gbelem::gap, gb(), lookupZZ, result(), ringtableZZ, VECTOR, weightInfo_, and x.

Referenced by remainder_ZZ(), and tail_remainder_ZZ().