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

◆ normal_form()

void QRingInfo_ZZ::normal_form ( ring_elem & f) const
virtual

Reimplemented from QRingInfo.

Definition at line 384 of file qring.cpp.

387{
389
390 const Monoid *M = R->getMonoid();
391 Nterm head;
392 Nterm *result = &head;
393 Nterm *t = f;
394 while (t != nullptr)
395 {
396 M->to_expvector(t->monom, EXP1);
397 int w = ringtableZZ->find_smallest_coeff_divisor(EXP1, 1);
398 if (w >= 0)
399 {
400 // reduce lead term as much as possible
401 // If the lead monomial reduces away, continue,
402 // else tack the monomial onto the result
403 Nterm *g = quotient_element(w);
404 if (reduce_lead_term_ZZ(t, g)) continue;
405 }
406 result->next = t;
407 t = t->next;
408 result = result->next;
409 }
410 result->next = nullptr;
411 f = head.next;
412}
exponents::Exponents exponents_t
void to_expvector(const_monomial m, exponents_t result_exp) const
Definition monoid.cpp:747
bool reduce_lead_term_ZZ(Nterm *&f, const Nterm *g) const
Definition qring.cpp:350
MonomialTableZZ * ringtableZZ
Definition qring.hpp:245
Nterm * quotient_element(int i) const
Definition qring.hpp:98
const PolyRing * R
Definition qring.hpp:83
size_t exp_size
Definition qring.hpp:86
VALGRIND_MAKE_MEM_DEFINED & result(result)
#define ALLOCATE_EXPONENTS(byte_len)
Definition monoid.hpp:62
Nterm * next
Definition ringelem.hpp:157
int monom[1]
Definition ringelem.hpp:160

References ALLOCATE_EXPONENTS, QRingInfo::exp_size, Nterm::monom, Nterm::next, QRingInfo::quotient_element(), QRingInfo::R, reduce_lead_term_ZZ(), result(), ringtableZZ, and Monoid::to_expvector().