474{
477
478 const Ring *gbringK =
GR->get_flattened_coefficients();
480 gbvector *lastterm = fsyz;
481 const gbvector *r;
482 gbvectorHeap fb(
GR,
F);
483 fb.add(f);
484 f = nullptr;
485 const gbvector *lead;
486 int q;
487
488 int count = 0;
490
491 while ((lead = fb.get_lead_term()) != nullptr)
492 {
494 {
495 SF->schreyer_down(lead->
monom, lead->
comp - 1, REDUCE_mon);
496 M->to_expvector(REDUCE_mon, REDUCE_exp);
497 }
498 else
499 M->to_expvector(lead->
monom, REDUCE_exp);
501 {
502 ring_elem u, v;
503
505
507 gbvector *h =
GR->mult_by_term(
F, r, v, REDUCE_mon, f->comp);
508 fb.add(h);
510 {
511 GR->gbvector_mult_by_coeff_to(fsyz, u);
512 GR->gbvector_mult_by_coeff_to(f, u);
515 }
516
517 fb.add(h);
519 count++;
520 }
522 {
523 ring_elem u, v;
524 gbringK->
syzygy(f->coeff,
gb[q]->coeff, u, v);
525 M->divide(lead->
monom,
gb[q]->monom, REDUCE_mon);
526 gbvector *h =
GR->mult_by_term(
F,
gb[q], v, REDUCE_mon, 0);
528 {
529 GR->gbvector_mult_by_coeff_to(fsyz, u);
530 GR->gbvector_mult_by_coeff_to(f, u);
531 }
534 lastterm = lastterm->
next;
535 fb.add(h);
537 count++;
538 }
539 else
540 {
541
542 fb.remove_lead_term();
544 "error in Schreyer reduction: element does not reduce to zero!");
545 }
546 }
547
549 {
550 buffer o;
551 o << count;
553 }
554}
exponents::Exponents exponents_t
int find_divisor(const MonomialIdeal *mi, const_exponents exp, int &result)
bool find_ring_divisor(const_exponents exp, const gbvector *&result)
gc_vector< gbvector * > gb
void wipe_unneeded_terms(gbvector *&f)
gc_vector< MonomialIdeal * > mi
gbvector * make_syz_term(ring_elem c, const_monomial monom, int comp) const
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
#define ALLOCATE_EXPONENTS(byte_len)
#define ALLOCATE_MONOMIAL(byte_len)
void emit_wrapped(const char *s)
void emit_line(const char *s)