45 for (
int i = 0; i < m->
n_cols(); i++)
61 for (
int i = 0; i <
elems.size(); i++)
70 :
F(m->get_free_module()),
79 K =
R->getCoefficients();
83 SF =
F->get_schreyer_order();
84 SG =
G->get_schreyer_order();
121 for (
int j = 0; j <
syzygies.size(); j++)
133 for (
int i = 0; i <
syzygies.size(); i++)
151#warning "this might add in the Schreyer up"
152#warning "the previous warning message is confusing, grammatically"
155 return GR->gbvector_raw_term(c, m, comp);
163 for (i = 0; i < g.size(); i++)
164 if (g[i] !=
nullptr) components[g[i]->comp - 1]++;
166 for (i = 0; i < g.size(); i++)
171 if (components[v->comp - 1] > 0)
177 last->
next =
nullptr;
195 SF->schreyer_down(
gb[i]->monom,
gb[i]->comp - 1, PAIRS_mon);
196 M->to_varpower(PAIRS_mon, vp);
199 M->to_varpower(
gb[i]->monom, vp);
204 if (
R->is_skew_commutative())
209 for (
int w = 0; w <
R->n_skew_commutative_vars(); w++)
210 if (find_pairs_exp[
R->skew_variable(w)] > 0)
214 Bag *b =
new Bag(
static_cast<void *
>(
nullptr), thisvp);
223 if (
R->is_quotient_ring())
226 for (
Bag& a : *Rideal)
235 Bag *b =
new Bag(
static_cast<void *
>(
nullptr), thisvp);
244 for (
Bag& a : *mi_orig)
260 for (
Bag& a : *new_mi)
262 M->from_varpower(a.monom().data(), m);
263 M->mult(m,
gb[i]->monom, m);
266 GR->get_flattened_coefficients()->from_long(1), m, i + 1);
281 if (!
R->is_quotient_ring())
return false;
283 if (!
R->get_quotient_monomials()->search_expvector(exp, b))
return false;
285 result =
R->quotient_gbvector(index);
296 int ndivisors = bb.size();
297 if (ndivisors == 0)
return 0;
298 result = bb[0]->basis_elem();
301 if (this_mi->
size() > 1)
304 o <<
":" << this_mi->
size() <<
"." << ndivisors <<
":";
309 if (this_mi->
size() == 1)
318 for (
int i = 1; i < ndivisors; i++)
320 int p = bb[i]->basis_elem();
321 if (
p < lowest) lowest =
p;
333 SG->schreyer_down(f->monom, f->comp - 1, si);
334 gbvector *h =
GR->mult_by_term(
F,
gb[f->comp - 1], f->coeff, si, 0);
350 while (g->
next !=
nullptr)
355 GR->gbvector_get_lead_exponents(
F, g->
next, exp);
356 if (
mi[g->
next->
comp - 1]->search_expvector(exp, b))
368 GR->gbvector_remove(tmp);
386 const Ring *gbringK =
GR->get_flattened_coefficients();
394 int max_len =
GR->gbvector_n_terms(f);
403 SF->schreyer_down(f->
monom, f->
comp - 1, REDUCE_mon);
404 M->to_expvector(REDUCE_mon, REDUCE_exp);
407 M->to_expvector(f->
monom, REDUCE_exp);
415 GR->gbvector_add_to(
F, f, h);
418 GR->gbvector_mult_by_coeff_to(fsyz, u);
419 GR->gbvector_mult_by_coeff_to(f, u);
430 M->divide(f->
monom,
gb[q]->monom, REDUCE_mon);
434 GR->gbvector_mult_by_coeff_to(fsyz, u);
435 GR->gbvector_mult_by_coeff_to(f, u);
437 int n1 =
GR->gbvector_n_terms(h);
439 int n2 =
GR->gbvector_n_terms(h);
440 nremoved += (n1 - n2);
442 lastterm = lastterm->
next;
445 int n3 =
GR->gbvector_n_terms(f);
446 GR->gbvector_add_to(
F, f, h);
447 int n4 =
GR->gbvector_n_terms(f);
448 if (n4 > max_len) max_len = n4;
460 "error in Schreyer reduction: element does not reduce to zero!");
468 o <<
"[" << max_len <<
" " << nhits <<
" " << nremoved <<
"]";
478 const Ring *gbringK =
GR->get_flattened_coefficients();
495 SF->schreyer_down(lead->
monom, lead->
comp - 1, REDUCE_mon);
496 M->to_expvector(REDUCE_mon, REDUCE_exp);
499 M->to_expvector(lead->
monom, REDUCE_exp);
511 GR->gbvector_mult_by_coeff_to(fsyz, u);
512 GR->gbvector_mult_by_coeff_to(f, u);
525 M->divide(lead->
monom,
gb[q]->monom, REDUCE_mon);
529 GR->gbvector_mult_by_coeff_to(fsyz, u);
530 GR->gbvector_mult_by_coeff_to(f, u);
534 lastterm = lastterm->
next;
544 "error in Schreyer reduction: element does not reduce to zero!");
Older Schreyer-style kernel computation, predecessor of schreyer-resolution/.
exponents::ConstExponents const_exponents
exponents::Exponents exponents_t
static void quotient(ConstExponents a, ConstExponents b, Vector &result)
static bool is_equal(ConstExponents a, ConstExponents b)
static void to_expvector(int n, ConstExponents a, exponents::Exponents result)
static void var(Exponent v, Exponent e, Vector &result)
static FreeModule * make_schreyer(const Matrix *m)
Engine-side free module R^n over a Ring.
int find_divisor(const MonomialIdeal *mi, const_exponents exp, int &result)
bool find_ring_divisor(const_exponents exp, const gbvector *&result)
void reduce(gbvector *&g, gbvector *&gsyz)
void geo_reduce(gbvector *&g, gbvector *&gsyz)
gc_vector< gbvector * > syzygies
virtual ~GBKernelComputation()
void strip_gb(const gc_vector< gbvector * > &m)
GBMatrix * get_syzygies()
gc_vector< gbvector * > gb
GBKernelComputation(const GBMatrix *m)
void wipe_unneeded_terms(gbvector *&f)
gbvector * s_pair(gbvector *syz)
gc_vector< MonomialIdeal * > mi
gbvector * make_syz_term(ring_elem c, const_monomial monom, int comp) const
ring_elem elem(int i, int j) const
void text_out(buffer &o) const
void set_column(int c, vec v)
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
void insert_minimal(Bag *b)
void find_all_divisors(const_exponents exp, VECTOR(Bag *)&b) const
Engine-side monomial ideal: a decision tree of Nmi_nodes storing the (typically minimal) generators b...
virtual GBRing * get_gb_ring() const
virtual gbvector * translate_gbvector_from_vec(const FreeModule *F, const vec v, ring_elem &result_denominator) const =0
virtual vec translate_gbvector_to_vec(const FreeModule *F, const gbvector *v) const =0
Abstract base for the engine's polynomial-ring hierarchy.
virtual void remove(ring_elem &f) const =0
virtual bool is_equal(const ring_elem f, const ring_elem g) const =0
virtual ring_elem from_long(long n) const =0
virtual void syzygy(const ring_elem a, const ring_elem b, ring_elem &x, ring_elem &y) const =0
gbvector * remove_lead_term()
const gbvector * get_lead_term()
gc_vector< int > & monom()
GBRing and gbvector — the GB-tuned polynomial-ring view used by classical Buchberger code.
const int * const_monomial
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 MONOMIAL_BYTE_SIZE(mon_size)
#define ALLOCATE_EXPONENTS(byte_len)
#define EXPONENT_BYTE_SIZE(nvars)
#define ALLOCATE_MONOMIAL(byte_len)
Monoid — variable count, naming, grading, and monomial order of a polynomial ring.
#define newarray_atomic_clear(T, len)
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)
gc_vector< gbvector * > elems
GBMatrix(const Matrix *m)
gbvector-side matrix: a target FreeModule plus a list of gbvector* columns living in it.
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.