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

◆ gb_reduce()

void GB_comp::gb_reduce ( gbvector *& f,
gbvector *& fsyz )
private

Definition at line 391 of file gb-homog2.cpp.

392{
394 {
395 gb_geo_reduce(f, fsyz);
396 return;
397 }
398 gbvector head;
399 gbvector *result = &head;
400 result->next = nullptr;
401
402 exponents_t div_totalexp = newarray_atomic(int, _M->n_vars());
403 int count = 0;
404 if (M2_gbTrace == 10)
405 {
406 buffer o;
407 o << "reducing ";
408 _GR->gbvector_text_out(o, _F, f);
409 emit_line(o.str());
410 }
411 while (f != nullptr)
412 {
413 Bag *b;
414 _GR->gbvector_get_lead_exponents(_F, f, div_totalexp);
415 if (originalR->is_quotient_ring() &&
416 originalR->get_quotient_monomials()->search_expvector(div_totalexp,
417 b))
418 {
419 const gbvector *g = originalR->quotient_gbvector(b->basis_elem());
420 _GR->gbvector_reduce_lead_term(_F, _Fsyz, head.next, f, fsyz, g, nullptr);
421 count++;
423 }
424 else if (_monideals[f->comp]->mi_search->search_expvector(div_totalexp,
425 b))
426 {
427 gb_elem *q = reinterpret_cast<gb_elem *>(b->basis_ptr());
428 _GR->gbvector_reduce_lead_term(
429 _F, _Fsyz, head.next, f, fsyz, q->f, q->fsyz);
430 count++;
432 if (M2_gbTrace == 10)
433 {
434 buffer o;
435 o << " reduced by ";
436 _GR->gbvector_text_out(o, _F, q->f);
437 o << newline;
438 o << " giving ";
439 _GR->gbvector_text_out(o, _F, f);
440 o << newline;
441 emit(o.str());
442 }
443 }
444 else
445 {
446 result->next = f;
447 f = f->next;
448 result = result->next;
449 result->next = nullptr;
450 }
451 }
452
453 if (M2_gbTrace >= 4)
454 {
455 buffer o;
456 o << "." << count;
457 emit_wrapped(o.str());
458 }
459 f = head.next;
460 freemem(div_totalexp);
461}
exponents::Exponents exponents_t
void gb_geo_reduce(gbvector *&f, gbvector *&fsyz)
const FreeModule * _Fsyz
Definition gb-homog2.hpp:74
const Monoid * _M
Definition gb-homog2.hpp:70
const FreeModule * _F
Definition gb-homog2.hpp:73
GBRing * _GR
Definition gb-homog2.hpp:68
const PolynomialRing * originalR
Definition gb-homog2.hpp:67
int _n_reductions
Definition gb-homog2.hpp:99
int _strategy
char * str()
Definition buffer.hpp:72
int basis_elem() const
Definition int-bag.hpp:66
void * basis_ptr() const
Definition int-bag.hpp:67
@ 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)
char newline[]
Definition m2-types.cpp:49
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_wrapped(const char *s)
Definition text-io.cpp:27
void emit_line(const char *s)
Definition text-io.cpp:47
void emit(const char *s)
Definition text-io.cpp:41

References _F, _Fsyz, _GR, _M, _n_reductions, _strategy, int_bag::basis_elem(), int_bag::basis_ptr(), gbvector::comp, emit(), emit_line(), emit_wrapped(), gb_elem::f, freemem(), gb_elem::fsyz, gb_geo_reduce(), M2_gbTrace, newarray_atomic, newline, gbvector::next, originalR, result(), buffer::str(), and STRATEGY_LONGPOLYNOMIALS.

Referenced by contains(), gen_step(), matrix_lift(), matrix_remainder(), and s_pair_step().