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

◆ find_good_term_divisor_ZZ()

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

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

1662{
1663 // Get all of the term divisors.
1664 // Choose one with the smallest gap.
1665 int i, gap, newgap, egap;
1666 int n = 0;
1667
1668 VECTOR(MonomialTableZZ::mon_term *) divisors;
1669 egap = degf - weightInfo_->exponents_weight(e, x);
1670
1671 /* First search for ring divisors */
1672 if (ringtableZZ) n += ringtableZZ->find_term_divisors(-1, c, e, 1, &divisors);
1673
1674 /* Next search for GB divisors */
1675 n += lookupZZ->find_term_divisors(-1, c, e, x, &divisors);
1676
1677 /* Now find the minimal gap value */
1678 if (n == 0)
1679 {
1680 result_gap = 0;
1681 return -1;
1682 }
1683 int result = divisors[n - 1]->_val;
1684 gbelem *tg = gb[result];
1685 gap = tg->gap - egap;
1686 if (gap <= 0)
1687 gap = 0;
1688 else
1689 for (i = n - 2; i >= 0; i--)
1690 {
1691 int new_val = divisors[i]->_val;
1692 tg = gb[new_val];
1693 newgap = tg->gap - egap;
1694 if (newgap <= 0)
1695 {
1696 gap = 0;
1697 result = new_val;
1698 break;
1699 }
1700 else if (newgap < gap)
1701 {
1702 result = new_val;
1703 gap = newgap;
1704 }
1705 }
1706 result_gap = gap;
1707 return result;
1708}
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 reduce_ZZ().