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

◆ minimalize()

void ReducedGB_ZZ::minimalize ( const VECTOR(POLY) & polys0,
bool auto_reduced )
virtual

Reimplemented from ReducedGB.

Definition at line 66 of file reducedgb-ZZ.cpp.

68{
69 // First sort these elements via increasing lex order (or monomial order?)
70 // Next insert minimal elements into T, and polys
71
72 VECTOR(int) positions;
73 positions.reserve(polys0.size());
74
75 for (int i = 0; i < polys0.size(); i++) positions.push_back(i);
76
77 std::stable_sort(
78 positions.begin(), positions.end(), ReducedGB_ZZ_sorter(R, F, polys0));
79
80 // Now loop through each element, and see if the lead monomial is in T.
81 // If not, add it in , and place element into 'polys'.
82
83 for (VECTOR(int)::iterator i = positions.begin(); i != positions.end(); i++)
84 {
85 gbvector *f = polys0[*i].f;
86 exponents_t e = R->exponents_make();
87 R->gbvector_get_lead_exponents(F, f, e);
88 if ((!ringtableZZ ||
89 !ringtableZZ->find_term_divisors(1, f->coeff.get_mpz(), e, 1)) &&
90 T->find_term_divisors(1, f->coeff.get_mpz(), e, f->comp) == 0)
91 {
92 // Keep this element
93
94 POLY h;
95 ring_elem junk;
96
97 h.f = R->gbvector_copy(f);
98 h.fsyz = R->gbvector_copy(polys0[*i].fsyz);
99
100 if (auto_reduced) remainder(h, false, junk); // This auto-reduces h.
101
102 if (h.f != nullptr && mpz_sgn(h.f->coeff.get_mpz()) < 0)
103 {
104 R->gbvector_mult_by_coeff_to(h.f, globalZZ->minus_one());
105 R->gbvector_mult_by_coeff_to(h.fsyz, globalZZ->minus_one());
106 }
107
108 T->insert(h.f->coeff.get_mpz(), e, h.f->comp, INTSIZE(polys));
109 polys.push_back(h);
110 }
111 else
112 R->exponents_delete(e);
113 }
114}
exponents::Exponents exponents_t
const MonomialTableZZ * ringtableZZ
MonomialTableZZ * T
virtual void remainder(POLY &f, bool use_denom, ring_elem &denom)
GBRing * R
Definition reducedgb.hpp:64
const FreeModule * F
Definition reducedgb.hpp:66
ring_elem minus_one() const
Definition ring.hpp:358
RingZZ * globalZZ
Definition relem.cpp:13
#define VECTOR(T)
Definition newdelete.hpp:78
#define POLY(q)
Definition poly.cpp:23
gbvector * fsyz
Definition gbring.hpp:99
gbvector * f
Definition gbring.hpp:98
ring_elem coeff
Definition gbring.hpp:81
int comp
Definition gbring.hpp:82
#define INTSIZE(a)
Definition style.hpp:37
mpz_srcptr get_mpz() const
Definition ringelem.hpp:127

References gbvector::coeff, gbvector::comp, ReducedGB::F, POLY::f, POLY::fsyz, ring_elem::get_mpz(), globalZZ, INTSIZE, POLY, ReducedGB::R, remainder(), ringtableZZ, T, and VECTOR.