20#define PrintingDegree 0x0001
30 int next = forwardingZZ[i];
34 next = forwardingZZ[prev];
39 o <<
"resolve(" << i <<
") = " << prev <<
newline;
40 std::cout << o.
str() << std::endl;
64 (void) use_max_degree_limit;
65 (void) max_degree_limit;
69 ERROR(
"ring is not a polynomial ring");
75 "cannot compute Groebner basis of ideal over a Laurent polynomial "
76 "ring, ie. with Inverses=>true");
81 if (overZZ and isLocal)
84 "Groebner bases in rings over ZZ with variables less than zero are "
104 int max_reduction_count0)
119 if (origR ==
nullptr)
121 ERROR(
"ring is not a polynomial ring");
130 _nvars =
R->get_flattened_monoid()->n_vars();
205 forwardingZZ.push_back(-1);
208 for (
int i = 0; i < m->
n_cols(); i++)
231 fsyz =
R->gbvector_term(
_Fsyz, denom, i + 1);
233 fsyz =
R->gbvector_zero();
235 if (
R->gbvector_is_zero(f))
237 originalR->get_quotient_info()->gbvector_normal_form(
_Fsyz, fsyz);
238 if (!
R->gbvector_is_zero(fsyz))
265 R->gbvector_remove(
gb[i]->g.f);
266 R->gbvector_remove(
gb[i]->g.fsyz);
268 for (
int i = 0; i <
gb.size(); i++)
276 for (
int i = 0; i < _syz.size(); i++)
278 R->gbvector_remove(_syz[i]);
305 for (i = 0; i < nvars; i++)
307 int diff = b[i] - a[i];
313 deg += diff * weights->array[i];
321 for (
int i = 0; i < nvars; i++)
322 if (a[i] != b[i])
return false;
328 for (
int i = 0; i < nvars; i++)
329 if (a[i] > b[i])
return false;
335 for (
int i = 0; i < nvars; i++)
337 if (a[i] < b[i])
return true;
338 if (a[i] > b[i])
return false;
354 R->gbvector_get_lead_exponents(
_F, f, g->
lead);
356 g->
gap = g->
deg - f_leadweight;
357 g->
size =
R->gbvector_n_terms(f);
372 R->gbvector_get_lead_exponents(
_F, f, g->
lead);
376 if (f->
next ==
nullptr)
381 g->
size =
R->gbvector_n_terms(f);
390 gnew->
g.
f =
R->gbvector_copy(g->
g.
f);
414 o <<
"g" << i <<
" = ";
415 R->gbvector_text_out(o,
_F,
gb[i]->g.f, nterms);
417 <<
"gap " <<
gb[i]->gap <<
" size " <<
gb[i]->size <<
" deg "
419 if (ismingen) o <<
" mingen";
432 result->lead_of_spoly =
nullptr;
438 if (
p ==
nullptr)
return;
441 R->gbvector_remove(
p->x.f.f);
442 R->gbvector_remove(
p->x.f.fsyz);
444 R->gbvector_remove(
p->lead_of_spoly);
479 R->gbvector_get_lead_exponents(
_F, f.
f, exp1);
498 int vvar =
R->skew_variable(v);
499 for (j = 0; j <
_nvars; j++) exp2[j] = 0;
528 snprintf(
s, N,
"spairgcd(g%d,g%d)",
p->x.pair.j,
p->x.pair.i);
530 snprintf(
s, N,
" deg(%d)",
p->deg);
533 for (
int i = 0; i <
_nvars + 2; i++)
535 snprintf(
s, N,
"%d ",
p->lcm[i]);
541 snprintf(
s, N,
"spair(g%d,g%d):",
p->x.pair.j,
p->x.pair.i);
543 snprintf(
s, N,
" deg %d",
p->deg);
545 o <<
" lcm exponents [";
546 for (
int i = 0; i <
_nvars + 2; i++)
548 snprintf(
s, N,
"%d ",
p->lcm[i]);
555 R->gbvector_text_out(o,
_F,
p->f(), 3);
559 R->gbvector_text_out(o,
_F,
p->f(), 3);
562 snprintf(
s, N,
"rpair(%d,%d)",
p->x.pair.i,
p->x.pair.j);
566 snprintf(
s, N,
"skewpair(g%d,g%d)",
p->x.pair.j,
p->x.pair.i);
580 #if __has_feature(thread_sanitizer)
581 #define __SANITIZE_THREAD__ 1
585#if __SANITIZE_THREAD__
586static std::atomic_ulong
ncalls(0);
587static std::atomic_ulong
nloops(0);
601 int i, first, second;
611 second =
p->x.pair.j;
612 p1exp =
gb[first]->lead;
618 if (mexp[i] > lcm[i])
return false;
621 for (i = 0; i <
_nvars; i++)
623 if (mexp[i] == lcm[i])
continue;
624 if (p1exp[i] == lcm[i])
continue;
628 if (!firstok)
return false;
629 for (i = 0; i <
_nvars; i++)
631 if (mexp[i] == lcm[i])
continue;
632 if (p2exp[i] == lcm[i])
continue;
647 while (
p->next !=
nullptr)
657 o <<
"removing unneeded ";
678 for (i = 0; i <
_nvars; i++)
679 if (e1[i] > 0 && e2[i] > 0)
return false;
684 gbA::spairs::iterator next)
691 if (next == first + 1)
return first;
699 spair_sorter(
int nv) : nvars(nv) {}
700 bool operator()(gbA::spair *a, gbA::spair *b)
704 int cmp = a->
deg - b->
deg;
753 int cmp = a->
deg - b->
deg;
776 result =
R->gbvector_compare(
F, a1, b1);
799 std::stable_sort(new_set.begin(), new_set.end(), spair_sorter(
_nvars));
803 spairs::iterator first = new_set.begin();
804 spairs::iterator next = first;
805 spairs::iterator
end = new_set.end();
806 for (; first !=
end; first = next)
829 o <<
"removing spair because of gcd: ";
852 for (spairs::iterator i = new_set.begin(); i != new_set.end(); i++)
861 VECTOR(mpz_srcptr) coeffs;
862 VECTOR(mpz_srcptr) coeffs2;
867 coeffs.reserve(
gb.size());
868 coeffs2.reserve(
gb.size());
869 exps.reserve(
gb.size());
870 comps.reserve(
gb.size());
872 for (
VECTOR(
spair *)::iterator i = new_set.begin(); i != new_set.end(); i++)
875 exps.push_back(a->
lcm);
883 coeffs.push_back(
globalZZ->one().get_mpz());
884 coeffs2.push_back(
nullptr);
894 coeffs2.push_back(v.
get_mpz());
896 if (mpz_cmpabs_ui(u.
get_mpz(), 1) && mpz_cmpabs_ui(v.
get_mpz(), 1))
913 _nvars, coeffs, exps, comps, positions);
916 _nvars, coeffs, exps, comps, positions,
true);
918 for (
VECTOR(
int)::iterator i = positions.begin(); i != positions.end(); i++)
931 mpz_ptr u = coeffs[*i];
932 mpz_ptr v = coeffs2[*i];
958 assert(
gb[
id] !=
nullptr);
969 if (
R->is_skew_commutative())
971 for (
int i = 0; i <
R->n_skew_commutative_vars(); i++)
972 if (r->
lead[
R->skew_variable(i)] > 0)
975 new_set.push_back(
s);
982 new_set.push_back(
s);
992 new_set.push_back(
s);
1035 S->spair_last_deferred =
nullptr;
1036 S->gen_last_deferred =
nullptr;
1042 while (
p !=
nullptr)
1049 tmp->
next =
S->heap;
1065 if (
S->spair_deferred_list.next !=
nullptr)
1069 emit_line(
"considering deferred pairs: ");
1071 S->spair_list =
S->spair_deferred_list.next;
1072 S->spair_deferred_list.next =
nullptr;
1073 S->spair_last_deferred = &
S->spair_deferred_list;
1087 if (
S->gen_deferred_list.next !=
nullptr)
1093 S->gen_list =
S->gen_deferred_list.next;
1094 S->gen_deferred_list.next =
nullptr;
1095 S->gen_last_deferred = &
S->gen_deferred_list;
1120 emit_line(
" deferred by reduction count");
1129 S->gen_last_deferred->next =
p;
1130 S->gen_last_deferred =
p;
1135 S->spair_last_deferred->next =
p;
1136 S->spair_last_deferred =
p;
1145 if (
S->heap ==
nullptr)
return 0;
1146 nextdeg =
S->heap->deg;
1147 for (
p =
S->heap->next;
p !=
nullptr;
p =
p->next)
1148 if (
p->deg > nextdeg)
1150 else if (
p->deg < nextdeg)
1157 nextdegree = nextdeg;
1165 S->spair_list =
nullptr;
1166 S->spair_deferred_list.next =
nullptr;
1167 S->spair_last_deferred = &
S->spair_deferred_list;
1169 S->gen_list =
nullptr;
1170 S->gen_deferred_list.next =
nullptr;
1171 S->gen_last_deferred = &
S->gen_deferred_list;
1174 if (len == 0)
return 0;
1178 head.
next =
S->heap;
1180 while (
p->next !=
nullptr)
1181 if (
p->next->deg != nextdegree)
1186 p->next = tmp->
next;
1189 tmp->
next =
S->gen_list;
1195 tmp->
next =
S->spair_list;
1196 S->spair_list = tmp;
1199 S->heap = head.
next;
1200 S->n_in_degree = len;
1213 spair *reversed =
nullptr;
1215 while (
p !=
nullptr)
1219 tmp->
next = reversed;
1228 if (ps ==
nullptr || ps->
next ==
nullptr)
return;
1229 if (len <= 1)
return;
1234 for (
spair *
p = ps;
p !=
nullptr;
p =
p->next)
1244 std::stable_sort(a.begin(), a.end(), SP);
1251 for (
int i = 1; i < asize; i++) a[i - 1]->next = a[i];
1264 if (asize > 0) a[asize - 1]->next = (bsize > 0 ? b[0] :
nullptr);
1267 for (
int i = 1; i < bsize; i++) b[i - 1]->next = b[i];
1268 b[bsize - 1]->next =
nullptr;
1282 R->gbvector_remove(
p->lead_of_spoly);
1283 p->lead_of_spoly =
nullptr;
1286 f =
gb[
p->x.pair.i]->g;
1289 const int *mon =
R->skew_monomial_var(
p->x.pair.j);
1290 R->gbvector_mult_by_term(
1291 _F,
_Fsyz,
R->one(), mon, f.
f,
nullptr,
p->lead_of_spoly, ltsyz);
1295 g =
gb[
p->x.pair.j]->g;
1296 R->gbvector_combine_lead_terms_ZZ(
1297 _F,
_Fsyz, f.
f,
nullptr, g.
f,
nullptr,
p->lead_of_spoly, ltsyz);
1301 g =
gb[
p->x.pair.j]->g;
1302 R->gbvector_cancel_lead_terms(
1303 _F,
_Fsyz, f.
f,
nullptr, g.
f,
nullptr,
p->lead_of_spoly, ltsyz);
1305 if (
p->lead_of_spoly !=
nullptr)
1308 p->lead_of_spoly->next =
nullptr;
1309 R->gbvector_remove(tmp);
1324 R->gbvector_remove(
p->lead_of_spoly);
1325 p->lead_of_spoly =
nullptr;
1330 const int *mon =
R->skew_monomial_var(
p->x.pair.j);
1331 R->gbvector_mult_by_term(
1338 R->gbvector_combine_lead_terms_ZZ(
1345 R->gbvector_cancel_lead_terms(
1353 R->gbvector_text_out(o,
_F,
p->f());
1371 o <<
"considering ";
1378 while (!
R->gbvector_is_zero(
p->f()))
1390 o <<
"ERROR: degree of polynomial is too high: deg " << wt
1391 <<
" termwt " << tmf <<
" expectedeg " <<
this_degree
1398 R->gbvector_get_lead_exponents(
_F,
p->f(), EXP);
1399 int x =
p->f()->comp;
1407 h.
f =
R->gbvector_copy(
p->x.f.f);
1408 h.
fsyz =
R->gbvector_copy(
p->x.f.fsyz);
1413 R->gbvector_reduce_lead_term(
_F,
1425 o <<
" reducing by g" << w;
1427 R->gbvector_text_out(o,
_F,
p->f(), 3);
1430 if (
R->gbvector_is_zero(
p->f()))
break;
1437 o <<
" deferring to degree " <<
p->deg;
1466 o <<
"considering ";
1473 while (!
R->gbvector_is_zero(
p->f()))
1485 o <<
"ERROR: degree of polynomial is too high: deg " << wt
1486 <<
" termwt " << tmf <<
" expectedeg " <<
this_degree
1493 R->gbvector_get_lead_exponents(
_F,
p->f(), EXP);
1494 int x =
p->f()->comp;
1495 mpz_srcptr c =
p->f()->coeff.get_mpz();
1502 if (w < 0 || gap > 0)
1515 o <<
" swapping with GB element " << t->
_val;
1529 R->gbvector_replace_2by2_ZZ(
1537 o <<
" swap yielded";
1541 R->gbvector_text_out(o,
_F,
p->f(), 3);
1545 R->gbvector_text_out(o,
_F, g->
g.
f, 3);
1556 h.
f =
R->gbvector_copy(
p->x.f.f);
1557 h.
fsyz =
R->gbvector_copy(
p->x.f.fsyz);
1562 R->gbvector_reduce_lead_term_ZZ(
1568 o <<
" reducing by g" << w;
1570 R->gbvector_text_out(o,
_F,
p->f(), 3);
1573 if (
R->gbvector_is_zero(
p->f()))
break;
1580 o <<
" deferring to degree " <<
p->deg;
1614 int i, gap, newgap, egap;
1623 n +=
ringtableZZ->find_monomial_divisors(-1, e, 1, &divisors);
1626 n +=
lookupZZ->find_monomial_divisors(-1, e,
x, &divisors);
1629 if (n == 0)
return -1;
1630 int result = divisors[0]->_val;
1632 gap = tg->
gap - egap;
1636 for (i = 1; i < n; i++)
1638 int new_val = divisors[i]->_val;
1640 newgap = tg->
gap - egap;
1647 else if (newgap < gap)
1665 int i, gap, newgap, egap;
1675 n +=
lookupZZ->find_term_divisors(-1, c, e,
x, &divisors);
1683 int result = divisors[n - 1]->_val;
1685 gap = tg->
gap - egap;
1689 for (i = n - 2; i >= 0; i--)
1691 int new_val = divisors[i]->_val;
1693 newgap = tg->
gap - egap;
1700 else if (newgap < gap)
1724 gap = tg->
gap - egap;
1736 n +=
lookup->find_divisors(-1, e,
x, &divisors);
1740 gbelem *tg =
gb[divisors[n - 1]->_val];
1746 for (
int j = 0; j < n; j++) o <<
"g" << divisors[j]->_val <<
" ";
1761 int j = divisors[i]->_val;
1763 gap =
gb[j]->gap - egap;
1764 if (gap < 0) gap = 0;
1775 result_gap = mingap;
1781 j = divisors[i]->_val;
1782 gap =
gb[j]->gap - egap;
1783 if (gap < 0) gap = 0;
1785 while (gap >= mingap);
1792 int result = divisors[n - 1]->_val;
1794 gap = tg->
gap - egap;
1798 int minsz = tg->
size;
1799 for (
int i = n - 2; i >= 0; i--)
1801 int new_val = divisors[i]->_val;
1806 if (tg->
gap <= egap)
1816 for (
int i = n - 2; i >= 0; i--)
1818 int new_val = divisors[i]->_val;
1821 newgap = tg->
gap - egap;
1828 else if (newgap < gap)
1858 frem->
next =
nullptr;
1861 while (!
R->gbvector_is_zero(h.
f))
1864 R->gbvector_get_lead_exponents(
_F, h.
f, EXP);
1868 if (w < 0 || gap > 0)
1873 frem->
next =
nullptr;
1878 if (!
R->gbvector_reduce_lead_term_ZZ(
1885 frem->
next =
nullptr;
1891 o <<
" tail rem by g" << w;
1893 R->gbvector_text_out(o,
_F, h.
f, 3);
1902 R->gbvector_mult_by_coeff_to(h.
f,
globalZZ->minus_one());
1903 R->gbvector_mult_by_coeff_to(h.
fsyz,
globalZZ->minus_one());
1910 o <<
"number of reduction steps was " << count;
1933 frem->
next =
nullptr;
1935 while (!
R->gbvector_is_zero(h.
f))
1938 R->gbvector_get_lead_exponents(
_F, h.
f, EXP);
1943 if (w < 0 || gap > 0)
1948 frem->
next =
nullptr;
1953 if (!
R->gbvector_reduce_lead_term_ZZ(
1960 frem->
next =
nullptr;
1967 o <<
" tail red by g" << w;
1969 R->gbvector_text_out(o,
_F, h.
f, 3);
1978 R->gbvector_mult_by_coeff_to(h.
f,
globalZZ->minus_one());
1979 R->gbvector_mult_by_coeff_to(h.
fsyz,
globalZZ->minus_one());
1986 o <<
"number of reduction steps was " << count;
2028 frem->
next =
nullptr;
2031 while (!
R->gbvector_is_zero(h.
f))
2034 R->gbvector_get_lead_exponents(
_F, h.
f, EXP);
2038 if (w < 0 || gap > 0)
2043 frem->
next =
nullptr;
2048 R->gbvector_reduce_lead_term(
2055 o <<
" tail reducing by ";
2056 R->gbvector_text_out(o,
_F, g.
f, 2);
2058 R->gbvector_text_out(o,
_F, h.
f, 3);
2064 R->gbvector_remove_content(h.
f, h.
fsyz, use_denom, denom);
2070 o <<
"number of reduction steps was " << count;
2095 if (!
gb[i])
continue;
2096 if (i ==
id)
continue;
2098 if (g->
deg < me->
deg)
return;
2099 if (g->
gap < a)
continue;
2103 o <<
" auto reduce " << i <<
" by " << id;
2108 R->gbvector_auto_reduce_ZZ(
_F,
2117 R->gbvector_auto_reduce(
_F,
2135 o <<
" new syzygy : ";
2136 R->gbvector_text_out(o,
_Fsyz, f, 3);
2156 R->gbvector_remove_content(f.
f, f.
fsyz,
false, junk);
2176 forwardingZZ.push_back(-1);
2202 snprintf(
s, N,
"new-inserting element %d (minimal %d): ", me, minlevel);
2204 R->gbvector_text_out(o,
_F, g->
g.
f);
2222#warning "todo: codimension stop condition"
2243 int gbval = t->
_val;
2245 gb[gbval] =
nullptr;
2253 R->gbvector_remove_content(g->
g.
f, g->
g.
fsyz,
false, not_used);
2259 forwardingZZ.push_back(-1);
2266 o <<
" retiring g" << gbval <<
" with new ";
2278 "replacing-inserting element %d (minimal %d replacing %d): ",
2283 R->gbvector_text_out(o,
_F, g->
g.
f);
2298 return gb[
p->x.pair.i] ==
nullptr or
gb[
p->x.pair.j] ==
nullptr;
2302 return gb[
p->x.pair.i] ==
nullptr;
2306 return gb[
p->x.pair.i] ==
nullptr;
2322 if (!not_deferred)
return true;
2329 p->x.f.fsyz =
nullptr;
2332 if (!
R->gbvector_is_zero(f.
f))
2340 if (!
R->gbvector_is_zero(f.
fsyz))
2357 if (
stop_.basis_element_limit > 0 &&
gb.size() >=
stop_.basis_element_limit)
2366 if (
stop_.use_codim_limit)
2389 vec v =
originalR->translate_gbvector_to_vec(
_F, f);
2394 return result.to_matrix();
2405 if (
stop_.always_stop)
return;
2479 if (
S->n_in_degree == 0)
2493 if (
stop_.stop_after_degree &&
2518 o <<
", number of spairs = " <<
npairs;
2520 o <<
", expected number in this degree = "
2581 R->gbvector_auto_reduce_ZZ(
_F,
2590 R->gbvector_auto_reduce(
_F,
2632 o <<
"ncalls = " <<
ncalls;
2635 o <<
"nloop = " <<
nloops;
2697 "cannot use Hilbert function for Groebner basis computation over the "
2740 for (
VECTOR(
gbvector *)::iterator i = _syz.begin(); i != _syz.end(); i++)
2757 return minimal_gb->get_parallel_lead_terms(w);
2767 const Matrix **result_remainder,
2768 const Matrix **result_quotient)
2771 return minimal_gb->matrix_lift(m, result_remainder, result_quotient);
2795 for (
unsigned int i = 0; i <
gb.size(); i++)
2799 R->gbvector_text_out(o,
_F,
gb[i]->g.f);
2814 while (
p !=
nullptr)
2823 for (
int i = 0; i < spairlist.size(); i++)
debug_spair(spairlist[i]);
2829 o <<
"Groebner basis, " <<
gb.size() <<
" elements";
2832 for (
unsigned int i = 0; i <
gb.size(); i++)
2845 for (
int i = 0; i <
gb.size(); i++)
2848 nmonoms +=
R->gbvector_n_terms(
gb[i]->g.f);
2849 nmonoms +=
R->gbvector_n_terms(
gb[i]->g.fsyz);
2852 o <<
"number of (nonminimal) gb elements = " <<
gb.size();
2855 o <<
"number of monomials = " << nmonoms;
exponents::Exponents exponents_t
enum ComputationStatusCode set_status(enum ComputationStatusCode)
FreeModule * sub_space(int n) const
Engine-side free module R^n over a Ring.
Polynomial-ring view tuned for the inner loop of classical Buchberger Groebner-basis computations.
Heuristic-weight evaluator for gbvectors, used during Groebner basis computation to drive the S-pair ...
const Ring * get_ring() const
const FreeModule * rows() const
const FreeModule * cols() const
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
int numNonTermOrderVariables() const
int numInvertibleVariables() const
void insert(exponents_t exp, int comp, int id)
static MonomialTable * make(int nvars)
int find_divisors(int max, exponents_t exp, int comp, VECTOR(mon_term *) *result=nullptr)
Indexed table of monomials with fast "find a divisor" lookup, keyed by a free integer val per entry.
static MonomialTableZZ * make(int nvars)
static void find_weak_generators(int nvars, const VECTOR(mpz_srcptr) &coeffs, const VECTOR(exponents_t) &exps, const VECTOR(int) &comps, VECTOR(int) &result_positions, bool use_stable_sort=true)
virtual int n_fraction_vars() const
virtual GBRing * get_gb_ring() const
virtual const Monoid * getMonoid() const
CoefficientType coefficient_type() const
Abstract base for the engine's polynomial-ring hierarchy.
static ReducedGB * create(const PolynomialRing *originalR0, const FreeModule *F0, const FreeModule *Fsyz0, const GBWeight *wt0=nullptr)
virtual const PolynomialRing * cast_to_PolynomialRing() const
static RingElement * make_raw(const Ring *R, ring_elem f)
const Ring * get_ring() const
Front-end-visible "ring element" value: an engine ring_elem paired with the Ring* that gives it meani...
bool operator()(value a, value b)
int compare(value a, value b)
SPolySorter(GBRing *R0, const FreeModule *F0)
Comparator on gbA::spair* used by the default Groebner basis driver to order its S-pair queue.
enum ComputationStatusCode computation_is_complete()
void spairs_reverse(spair *&ps)
void spair_delete(spair *&p)
void compute_s_pair(spair *p)
void minimalize_pairs_non_ZZ(spairs &new_set)
MonomialTable * ringtable
int get_resolved_gb_index(int i) const
int spair_COMPONENT(spair *s)
virtual const Matrix * get_change()
void spair_text_out(buffer &o, spair *p)
Ring::CoefficientType _coeff_type
const PolynomialRing * originalR
virtual const Matrix * get_mingens()
void spair_set_show_mem_usage()
int find_good_monomial_divisor_ZZ(mpz_srcptr c, exponents_t e, int x, int degf, int &result_gap)
void tail_remainder_ZZ(POLY &f, int degf)
void spair_set_lead_spoly(spair *p)
int divisor_previous_comp
virtual M2_bool matrix_lift(const Matrix *m, const Matrix **result_remainder, const Matrix **result_quotient)
void replace_gb_element_ZZ(MonomialTableZZ::mon_term *t)
void spair_set_insert(spair *p)
void remainder_ZZ(POLY &f, int degf, bool use_denom, ring_elem &denom)
gbelem * gbelem_ring_make(gbvector *f)
int gbelem_COMPONENT(gbelem *g)
virtual void text_out(buffer &o) const
gbelem * gbelem_make(gbvector *f, gbvector *fsyz, gbelem_type minlevel, int deg)
spair * spair_make_gcd_ZZ(int i, int j)
virtual const Matrix * matrix_remainder(const Matrix *m)
virtual int complete_thru_degree() const
MonomialTableZZ * lookupZZ
void remainder(POLY &f, int degf, bool use_denom, ring_elem &denom)
enum gbA::gbA_state state
spair * new_gen(int i, gbvector *f, ring_elem denom)
void initialize(const Matrix *m, int csyz, int nsyz, M2_arrayint gb_weights, int strat, int max_reduction_count0)
static gbA * create(const Matrix *m, M2_bool collect_syz, int n_rows_to_keep, M2_arrayint gb_weights, int strategy, M2_bool use_max_degree, int max_degree, int max_reduction_count)
void debug_spair_array(spairs &spairlist)
bool spair_is_retired(spair *p) const
int complete_thru_this_degree
void gbelem_text_out(buffer &o, int i, int nterms=3) const
spair * spair_make_gen(POLY f)
void auto_reduce_by(int id)
bool is_gcd_one_pair(spair *p)
virtual const Matrix * get_gb()
virtual const Matrix * get_initial(int nparts)
int find_good_divisor(exponents_t e, int x, int degf, int &result_gap)
const GBWeight * weightInfo_
void spairs_sort(int len, spair *&list)
spair * spair_make_ring(int i, int j)
bool pair_not_needed(spair *p, gbelem *m)
virtual int contains(const Matrix *m)
int spair_set_prepare_next_degree(int &nextdegree)
void minimalize_pairs(spairs &new_set)
virtual const Matrix * get_syzygies()
void minimalize_pairs_ZZ(spairs &new_set)
bool process_spair(spair *p)
void remove_unneeded_pairs(int id)
Matrix * make_lead_term_matrix()
spair * spair_make_skew(int i, int v)
void debug_spair(spair *p)
spairs::iterator choose_pair(spairs::iterator first, spairs::iterator next)
virtual const Matrix * get_parallel_lead_terms(M2_arrayint w)
spair * spair_make(int i, int j)
void remainder_non_ZZ(POLY &f, int degf, bool use_denom, ring_elem &denom)
void insert_gb(POLY f, gbelem_type minlevel)
void remove_spair_list(spair *&set)
void update_pairs(int id)
void debug_spairs(spair *spairlist)
virtual Computation * set_hilbert_function(const RingElement *h)
const MonomialTableZZ * ringtableZZ
exponents_t exponents_make()
void spair_set_defer(spair *&p)
gbelem * gbelem_copy(gbelem *g)
int find_good_term_divisor_ZZ(mpz_srcptr c, exponents_t e, int x, int degf, int &result_gap)
void collect_syzygy(gbvector *fsyz)
const RingElement * hf_orig
int spair_set_determine_next_degree(int &nextdegree)
The default Groebner basis computation class.
static int coeff_of(const RingElement *h, int deg)
static RingElement * hilbertNumerator(const Matrix *M)
@ COMP_DONE_SUBRING_LIMIT
void gb(IntermediateBasis &F, int n)
static unsigned long nsaved_unneeded
static bool exponents_divide(int nvars, exponents_t a, exponents_t b)
static bool exponents_less_than(int nvars, exponents_t a, exponents_t b)
static unsigned long nloops
static void exponents_lcm(int nvars, int dega, exponents_t a, exponents_t b, exponents_t result, M2_arrayint weights, int &result_degree)
static bool exponents_equal(int nvars, exponents_t a, exponents_t b)
static unsigned long ncalls
gbA — the engine's default Buchberger-style Groebner-basis algorithm.
GBWeight — packed-weight evaluator that drives S-pair selection.
Hilbert-series numerator via the Bigatti-Caboara-Robbiano recursion.
bool system_interrupted()
system_interrupted() — thread-safe polling predicate for Ctrl+C handling.
VALGRIND_MAKE_MEM_DEFINED & result(result)
MatrixConstructor — the mutable builder that produces an immutable Matrix.
Matrix — the engine's immutable homomorphism F -> G between free modules.
#define ALLOCATE_EXPONENTS(byte_len)
#define EXPONENT_BYTE_SIZE(nvars)
QuickSorter<Sorter> — ring-agnostic in-place sort over a duck-typed adapter.
our_new_delete — per-class opt-in routing of new / delete through bdwgc.
PolynomialRing — abstract polynomial-ring base, the engine's most-reused class.
ReducedGB — abstract base for the canonicalising reduction pass that follows GB computation.
RingElement — tagged (Ring*, ring_elem) pair, the engine's universal element type.
TermIterator< Nterm > end(Nterm *)
Doubly-linked-list node of a MonomialTable's per-component monomial list.
MonomialTable::mon_term plus an _coeff slot pointing at the entry's leading ZZ coefficient (or nullpt...
spair * spair_last_deferred
spair * gen_last_deferred
union gbA::spair::@344103323053032064111352014125043204306347255347 x
struct gbA::spair::@344103323053032064111352014125043204306347255347::pair pair
void emit_wrapped(const char *s)
void emit_line(const char *s)
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.
mpz_srcptr get_mpz() const