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

◆ gb_reduce()

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

Definition at line 328 of file res-a2-gb.cpp.

329{
331 {
332 gb_geo_reduce(f, fsyz);
333 return;
334 }
335 gbvector head;
336 gbvector *result = &head;
337 result->next = nullptr;
338
339 exponents_t div_totalexp = newarray_atomic(int, M->n_vars());
340 int count = 0;
341 if (M2_gbTrace == 10)
342 {
343 buffer o;
344 o << "reducing ";
345 GR->gbvector_text_out(o, F, f);
346 emit_line(o.str());
347 }
348 while (f != nullptr)
349 {
350 Bag *b;
351 GR->gbvector_get_lead_exponents(F, f, div_totalexp);
352 if (originalR->is_quotient_ring() &&
353 originalR->get_quotient_monomials()->search_expvector(div_totalexp,
354 b))
355 {
356 const gbvector *g = originalR->quotient_gbvector(b->basis_elem());
357 GR->gbvector_reduce_lead_term(F, Fsyz, head.next, f, fsyz, g, nullptr);
358 count++;
359 }
360 else if (monideals[f->comp]->mi_search->search_expvector(div_totalexp, b))
361 {
362 gb_elem *q = reinterpret_cast<gb_elem *>(b->basis_ptr());
363 GR->gbvector_reduce_lead_term(
364 F, Fsyz, head.next, f, fsyz, q->f, q->fsyz);
365 count++;
366 if (M2_gbTrace == 10)
367 {
368 buffer o;
369 o << " reduced by ";
370 GR->gbvector_text_out(o, F, q->f);
371 o << newline;
372 o << " giving ";
373 GR->gbvector_text_out(o, F, f);
374 o << newline;
375 emit(o.str());
376 }
377 }
378 else
379 {
380 result->next = f;
381 f = f->next;
382 result = result->next;
383 result->next = nullptr;
384 }
385 }
386
387 if (M2_gbTrace >= 4)
388 {
389 buffer o;
390 o << "." << count;
391 emit_wrapped(o.str());
392 }
393 f = head.next;
394 freemem(div_totalexp);
395}
exponents::Exponents exponents_t
char * str()
Definition buffer.hpp:72
FreeModule * Fsyz
Definition res-a2.hpp:121
void gb_geo_reduce(gbvector *&f, gbvector *&fsyz)
int strategy_flags
Definition res-a2.hpp:160
FreeModule * F
Definition res-a2.hpp:120
const Monoid * M
Definition res-a2.hpp:115
const PolynomialRing * originalR
Definition res-a2.hpp:113
GBRing * GR
Definition res-a2.hpp:114
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 int_bag::basis_elem(), int_bag::basis_ptr(), gbvector::comp, emit(), emit_line(), emit_wrapped(), F, gb_elem::f, freemem(), Fsyz, gb_elem::fsyz, gb_geo_reduce(), GR, M, M2_gbTrace, newarray_atomic, newline, gbvector::next, originalR, result(), buffer::str(), strategy_flags, and STRATEGY_LONGPOLYNOMIALS.

Referenced by receive_generator(), reduce(), and s_pair_step().