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

◆ gb_reduce() [1/2]

void HermiteComputation::gb_reduce ( vec & f) const
private

Definition at line 387 of file hermite.cpp.

388{
389 // Reduce f so that each of its terms are < corresponding initial term
390 // (in absolute value).
391 vecterm head;
392 vecterm *result = &head;
393 head.next = nullptr;
394 while (f != nullptr)
395 {
396 int x = f->comp;
397 hm_elem *h = initial[x];
398 if (h != nullptr)
399 {
400 ring_elem v;
401 ring_elem rem =
402 globalZZ->remainderAndQuotient(f->coeff, h->f->coeff, v);
403 bool do_reduce = !globalZZ->is_zero(v);
404 if (do_reduce)
405 {
406 v = globalZZ->negate(v);
407 vec g = globalZZ->mult_vec(v, h->f);
408 globalZZ->add_vec_to(f, g);
409 }
410 if (globalZZ->is_zero(rem)) continue;
411 }
412 // The lead term stays
413 result->next = f;
414 f = f->next;
415 result = result->next;
416 result->next = nullptr;
417 continue;
418 }
419
420 f = head.next;
421}
vec mult_vec(int n, vec v) const
void add_vec_to(vec &v, vec &w) const
virtual ring_elem negate(const ring_elem f) const
Definition ZZ.cpp:243
virtual bool is_zero(const ring_elem f) const
Definition ZZ.cpp:155
virtual ring_elem remainderAndQuotient(const ring_elem f, const ring_elem g, ring_elem &quot) const
Definition ZZ.cpp:317
RingZZ * globalZZ
Definition relem.cpp:13
VALGRIND_MAKE_MEM_DEFINED & result(result)
const mpreal rem(const mpreal &x, const mpreal &y, mp_rnd_t rnd_mode=mpreal::get_default_rnd())
Definition mpreal.h:2628
volatile int x
vec f
Definition hermite.hpp:46

References hm_elem::f, globalZZ, vec::next, result(), and x.

Referenced by contains(), matrix_lift(), matrix_remainder(), and start_computation().