37 ERROR(
"ring is not a polynomial ring");
44 _M =
_GR->get_flattened_monoid();
45 _K =
_GR->get_flattened_coefficients();
76 for (i = 0; i <=
_F->rank(); i++)
80 _monideals.push_back(
p);
99 for (i = 0; i < m->
n_cols(); i++)
118 int max_degree_limit)
120 (void) use_max_degree_limit;
121 (void) max_degree_limit;
123 result->initialize(m, collect_syz, n_rows_to_keep, gb_weights, strategy);
129 _GR->gbvector_remove(
p->f);
130 _GR->gbvector_remove(
p->fsyz);
191 fsyz =
_GR->gbvector_term(
_Fsyz, denom, i + 1);
193 fsyz =
_GR->gbvector_zero();
195 if (
_GR->gbvector_is_zero(f))
197 if (!
_GR->gbvector_is_zero(fsyz))
199 _syz.push_back(fsyz);
236 while (
_GR->gbvector_compare(
_F, _gb[j]->f, pivot_elem) > 0);
242 while (
_GR->gbvector_compare(
_F, _gb[i]->f, pivot_elem) < 0);
277 _GR->gbvector_get_lead_monomial(
_F,
p->f, f_m);
278 if (
_GR->is_skew_commutative())
280 _M->to_expvector(f_m, find_pairs_exp);
282 for (
int v = 0; v <
_GR->n_skew_commutative_vars(); v++)
284 int w =
_GR->skew_variable(v);
285 if (find_pairs_exp[w] == 0)
continue;
288 _M->from_expvector(find_pairs_exp, find_pairs_lcm);
292 _M->to_varpower(find_pairs_lcm, vplcm);
294 elems.push_back(
new Bag(q, vplcm));
302 for (
int i = 0; i <
originalR->n_quotients(); i++)
305 _M->lcm(f->
monom, f_m, find_pairs_lcm);
307 _M->to_varpower(find_pairs_lcm, vplcm);
309 elems.push_back(
new Bag(q, vplcm));
316 _M->from_varpower(a.monom().data(), find_pairs_m);
317 _M->lcm(find_pairs_m, f_m, find_pairs_lcm);
319 _M->to_varpower(find_pairs_lcm, vplcm);
322 reinterpret_cast<gb_elem *
>(a.basis_ptr()),
324 elems.push_back(
new Bag(q, vplcm));
329 _M->to_varpower(f_m, vp);
337 for (
auto& b : rejects)
349 if (
_M->is_one(find_pairs_m))
369 _M->remove(find_pairs_m);
380 _M->divide(
p->lcm,
p->first->f->monom,
s);
382 _GR->gbvector_mult_by_term(
385 _GR->gbvector_reduce_lead_term(
386 _F,
_Fsyz,
nullptr,
p->f,
p->fsyz,
p->second->f,
p->second->fsyz);
408 _GR->gbvector_text_out(o,
_F, f);
414 _GR->gbvector_get_lead_exponents(
_F, f, div_totalexp);
416 originalR->get_quotient_monomials()->search_expvector(div_totalexp,
420 _GR->gbvector_reduce_lead_term(
_F,
_Fsyz, head.
next, f, fsyz, g,
nullptr);
424 else if (_monideals[f->
comp]->mi_search->search_expvector(div_totalexp,
428 _GR->gbvector_reduce_lead_term(
436 _GR->gbvector_text_out(o,
_F, q->
f);
439 _GR->gbvector_text_out(o,
_F, f);
480 _GR->gbvector_get_lead_exponents(
_F, lead, div_totalexp);
482 originalR->get_quotient_monomials()->search_expvector(div_totalexp,
486 _GR->reduce_lead_term_heap(
_F,
497 else if (_monideals[lead->
comp]->mi_search->search_expvector(div_totalexp,
501 _GR->reduce_lead_term_heap(
_F,
528 fsyz = fsyzb.
value();
535 while ((
p =
_spairs->remove()) !=
nullptr)
536 if (
p->degree != deg)
546 while ((
p =
_gens->remove()) !=
nullptr)
547 if (
p->degree != deg)
564 _GR->gbvector_get_lead_monomial(
_F,
p->f, f_m);
565 _GR->gbvector_remove_content(
p->f,
p->fsyz);
575 _M->to_varpower(f_m, vp);
576 _monideals[
p->f->comp]->mi_search->insert(
new Bag(
p, vp));
611 emit(
"Computing spair ");
624 if (!
_GR->gbvector_is_zero(f))
629 o <<
" inserting GB element " <<
_n_gb;
630 _GR->gbvector_text_out(o,
_F, f);
637 if (!
_GR->gbvector_is_zero(fsyz))
642 _syz.push_back(fsyz);
647 _GR->gbvector_remove(fsyz);
680 if (!
_GR->gbvector_is_zero(f))
686 if (!
_GR->gbvector_is_zero(fsyz))
691 _syz.push_back(fsyz);
696 _GR->gbvector_remove(fsyz);
716 _GR->gbvector_auto_reduce(
_F,
743 if (
stop_.basis_element_limit > 0 &&
_n_gb >
stop_.basis_element_limit)
752 if (
stop_.use_codim_limit)
773 else if (q !=
nullptr)
778 if (q !=
nullptr)
_gens->put_back(q);
789#warning "not implemented yet"
821 if (
stop_.stop_after_degree &&
856 o <<
_spairs->n_elems() <<
')';
932 for (
int j =
_np_i; j <
_n_gb; j++) _gb[j]->me = j;
967 if (q ==
nullptr)
return;
970 if (q->
first !=
nullptr)
980 _M->elem_text_out(o, q->
lcm);
1006 for (
int i = 0; i < _gb.size(); i++)
1008 vec v =
originalR->translate_gbvector_to_vec(
_F, _gb[i]->f);
1019 for (
int i = 0; i < _gb.size(); i++)
1029 for (
int i = 0; i < _gb.size(); i++)
1038 for (
int i = 0; i < _syz.size(); i++)
1047 for (
int i = 0; i < _gb.size(); i++)
1049 gbvector *f =
_GR->gbvector_lead_term(nparts,
_F, _gb[i]->f);
1061 for (
int i = 0; i < _gb.size(); i++)
1064 _GR->gbvector_parallel_lead_terms(w,
_F, _gb[i]->f, _gb[i]->f);
1074 ERROR(
"expected matrix over the same ring");
1080 ERROR(
"expected matrices to have same number of rows");
1085 for (
int i = 0; i < m->
n_cols(); i++)
1093 vec fv =
originalR->translate_gbvector_to_vec_denom(
_F, f, denom);
1100 const Matrix **result_remainder,
1101 const Matrix **result_quotient)
1105 ERROR(
"expected matrix over the same ring");
1106 *result_remainder =
nullptr;
1107 *result_quotient =
nullptr;
1112 ERROR(
"expected matrices to have same number of rows");
1113 *result_remainder =
nullptr;
1114 *result_quotient =
nullptr;
1120 bool all_zeroes =
true;
1121 for (
int i = 0; i < m->
n_cols(); i++)
1128 if (f !=
nullptr) all_zeroes =
false;
1130 vec fv =
originalR->translate_gbvector_to_vec_denom(
_F, f, denom);
1131 _K->negate_to(denom);
1135 mat_quotient.
append(fsyzv);
1137 *result_remainder = mat_remainder.
to_matrix();
1138 *result_quotient = mat_quotient.
to_matrix();
1149 ERROR(
"expected matrix over the same ring");
1154 for (
int i = 0; i < m->
n_cols(); i++)
1161 _GR->gbvector_remove(fsyz);
1164 _GR->gbvector_remove(f);
1183 for (
int i = 0; i < _gb.size(); i++)
1186 _GR->gbvector_text_out(o,
_F, _gb[i]->f);
exponents::Exponents exponents_t
enum ComputationStatusCode set_status(enum ComputationStatusCode)
FreeModule * sub_space(int n) const
virtual const Matrix * get_change()
RingElement * compute_hilbert_function() const
void gb_geo_reduce(gbvector *&f, gbvector *&fsyz)
void gb_sort(int lo, int hi)
void gb_reduce(gbvector *&f, gbvector *&fsyz)
s_pair * new_ring_pair(gb_elem *p, const int *lcm)
virtual const Matrix * get_gb()
virtual M2_bool matrix_lift(const Matrix *m, const Matrix **result_remainder, const Matrix **result_quotient)
void remove_pair(s_pair *&p)
void find_pairs(gb_elem *p)
static GB_comp * 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)
virtual const Matrix * get_initial(int nparts)
void initialize0(const Matrix *m, int csyz, int nsyz, M2_arrayint gb_weights)
virtual const Matrix * get_mingens()
void gb_insert(gbvector *f, gbvector *fsyz, int ismin)
virtual void text_out(buffer &o) const
virtual int complete_thru_degree() const
s_pair * new_var_pair(gb_elem *p, const int *lcm)
virtual int contains(const Matrix *m)
int gb_sort_partition(int lo, int hi)
const GBWeight * weightInfo_
s_pair * new_s_pair(gb_elem *p, gb_elem *q, const int *lcm)
void compute_s_pair(s_pair *p)
const PolynomialRing * originalR
void initialize(const Matrix *m, int csyz, int nsyz, M2_arrayint gb_weights, int strategy)
virtual const Matrix * get_syzygies()
virtual const Matrix * matrix_remainder(const Matrix *m)
virtual Computation * set_hilbert_function(const RingElement *h)
ComputationStatusCode computation_is_complete() const
virtual const Matrix * get_parallel_lead_terms(M2_arrayint w)
s_pair * new_gen(int i, gbvector *f, ring_elem denom)
void flush_pairs(int deg)
const RingElement * _hf_orig
void debug_out(s_pair *q) const
Heuristic-weight evaluator for gbvectors, used during Groebner basis computation to drive the S-pair ...
const_monomial degree_shift() const
const Ring * get_ring() const
const FreeModule * rows() const
const FreeModule * cols() const
void set_column(int c, vec v)
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
Engine-side monomial ideal: a decision tree of Nmi_nodes storing the (typically minimal) generators b...
virtual GBRing * get_gb_ring() const
Abstract base for the engine's polynomial-ring hierarchy.
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...
gbvector * remove_lead_term()
const gbvector * get_lead_term()
static int coeff_of(const RingElement *h, int deg)
@ STRATEGY_LONGPOLYNOMIALS
@ COMP_DONE_SUBRING_LIMIT
const int GB_COMP_NEWPAIRS
const int GB_COMP_AUTO_REDUCE
const int GB_COMP_NEED_RESIZE
const int GB_COMP_S_PAIRS
const int GB_COMP_NEWDEGREE
GB_comp — Buchberger GB specialised to homogeneous input.
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.
typename std::vector< T, gc_allocator< T > > gc_vector
a version of the STL vector, which allocates its backing memory with gc.
#define newarray_atomic(T, len)
Engine-wide stylistic constants: LT / EQ / GT codes, INTSIZE, GEOHEAP_SIZE.
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.