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

◆ gb_reduce()

int GBinhom_comp::gb_reduce ( gbvector *& f,
gbvector *& fsyz )
private

Definition at line 461 of file gb-sugarless.cpp.

462{
463 if ((strategy & STRATEGY_LONGPOLYNOMIALS) != 0) return gb_geo_reduce(f, fsyz);
464 gbvector head;
465 gbvector *result = &head;
466 result->next = nullptr;
467 gb_elem *q;
468
469 exponents_t div_totalexp = newarray_atomic(int, M->n_vars());
470 int count = 0;
471 if (M2_gbTrace == 10)
472 {
473 buffer o;
474 o << "reducing ";
475 GR->gbvector_text_out(o, F, f);
476 emit_line(o.str());
477 }
478 while (f != nullptr)
479 {
480 GR->gbvector_get_lead_exponents(F, f, div_totalexp);
481#ifdef DEVELOPMENT
482#warning "quotient ring stuff"
483#endif
484 Bag *b;
485 if (originalR->is_quotient_ring() &&
486 originalR->get_quotient_monomials()->search_expvector(div_totalexp,
487 b))
488 {
489 const gbvector *g = originalR->quotient_gbvector(b->basis_elem());
490 GR->gbvector_reduce_lead_term(F, Fsyz, head.next, f, fsyz, g, nullptr);
491 count++;
492 }
493 else if (search(div_totalexp, f->comp, q))
494 {
495 GR->gbvector_reduce_lead_term(
496 F, Fsyz, head.next, f, fsyz, q->f, q->fsyz);
497 count++;
498 }
499 else
500 {
501 result->next = f;
502 f = f->next;
503 result = result->next;
504 result->next = nullptr;
505 }
506 }
507 if (M2_gbTrace >= 4)
508 {
509 buffer o;
510 o << "." << count;
511 emit(o.str());
512 }
513
514 f = head.next;
515 freemem(div_totalexp);
516 return 1;
517}
exponents::Exponents exponents_t
const FreeModule * Fsyz
const FreeModule * F
int gb_geo_reduce(gbvector *&f, gbvector *&fsyz)
const Monoid * M
int search(const int *exp, int comp, gb_elem *&result)
const PolynomialRing * originalR
char * str()
Definition buffer.hpp:72
int basis_elem() const
Definition int-bag.hpp:66
@ STRATEGY_LONGPOLYNOMIALS
int_bag Bag
Definition int-bag.hpp:70
void freemem(void *s)
Definition m2-mem.cpp:103
VALGRIND_MAKE_MEM_DEFINED & result(result)
int M2_gbTrace
Definition m2-types.cpp:52
#define newarray_atomic(T, len)
Definition newdelete.hpp:91
gbvector * fsyz
Definition spair.hpp:59
gbvector * f
Definition spair.hpp:58
gbvector * next
Definition gbring.hpp:80
int comp
Definition gbring.hpp:82
void emit_line(const char *s)
Definition text-io.cpp:47
void emit(const char *s)
Definition text-io.cpp:41

References int_bag::basis_elem(), gbvector::comp, emit(), emit_line(), F, gb_elem::f, freemem(), Fsyz, gb_elem::fsyz, gb_geo_reduce(), GR, M, M2_gbTrace, newarray_atomic, gbvector::next, originalR, result(), search(), buffer::str(), strategy, and STRATEGY_LONGPOLYNOMIALS.

Referenced by s_pair_step().