10 :
R(RR),
M(
R->getMonoid()),
K(
R->getCoefficientRing())
13 sizeof(
int) *
M->monomial_size();
21 if (cmp != 0)
return cmp;
23 if (cmp > 0)
return 1;
24 if (cmp < 0)
return -1;
48 for (
const res2term *tm = f; tm !=
nullptr; tm = tm->
next)
53 result->coeff =
K->copy(tm->coeff);
54 M->mult(tm->monom, m,
result->monom);
65 for (
const res2term *tm = f; tm !=
nullptr; tm = tm->
next)
70 result->coeff =
K->mult(c, tm->coeff);
71 M->copy(tm->monom,
result->monom);
81 for (
const res2term *tm = f; tm !=
nullptr; tm = tm->
next)
86 result->coeff =
K->copy(tm->coeff);
87 M->copy(tm->monom,
result->monom);
109 for (
const res2term *tm = f; tm !=
nullptr; tm = tm->
next)
114 result->coeff =
K->mult(c, tm->coeff);
115 M->mult(tm->monom, m,
result->monom);
132 result->coeff =
K->mult(c, tm.coeff);
133 M->mult(tm.monom, m,
result->monom);
141 if (f ==
nullptr)
return;
145 K->mult_to(tm->coeff, c_inv);
152 if (g ==
nullptr)
return;
161 while (1)
switch (
compare(f, g))
192 if (
K->is_zero(tmf->
coeff))
263 bool p_parens =
true;
267 int isone =
M->is_one(t->monom);
268 K->elem_text_out(o, t->coeff, p_one, p_plus, p_parens);
269 if (!isone)
M->elem_text_out(o, t->monom, p_one);
270 o <<
"<" << t->comp->me <<
">";
281 for (
const res2term *tm = f; tm !=
nullptr; tm = tm->
next)
284 int x = tm->comp->me;
285 M->divide(tm->monom, tm->comp->syz->monom, mon);
287 ring_elem a =
R->make_flat_term(tm->coeff, mon);
288 vec tmp =
R->make_vec(
x, a);
301 for (
vecterm *w = v; w !=
nullptr; w = w->next)
321 for (
const res2term *tm = f; tm !=
nullptr; tm = tm->
next)
327 result->coeff =
K->copy(tm->coeff);
328 M->copy(tm->monom,
result->monom);
337 for (
const res2term *tm = f; tm !=
nullptr; tm = tm->
next)
338 if (tm->comp ==
x)
return tm;
348 if (f ==
nullptr || f->
next ==
nullptr)
return;
358 if (f ==
nullptr)
break;
Engine-side free module R^n over a Ring.
Abstract base for the engine's polynomial-ring hierarchy.
res2_poly(PolynomialRing *R)
res2term * copy(const res2term *f) const
res2term * from_vector(const VECTOR(res2_pair *)&base, const vec v) const
const res2term * component_occurs_in(const res2_pair *x, const res2term *f) const
res2term * mult_by_monomial(const res2term *f, const int *m) const
void sort(res2term *&f) const
res2term * strip(const res2term *f) const
void add_to(res2term *&f, res2term *&g) const
int n_terms(const res2term *f) const
res2term * ring_mult_by_term(const ring_elem f, ring_elem c, const int *m, res2_pair *x) const
void make_monic(res2term *&f) const
void ring_subtract_multiple_to(res2term *&f, ring_elem c, const int *m, res2_pair *x, const ring_elem g) const
void subtract_multiple_to(res2term *&f, ring_elem c, const int *m, const res2term *g) const
int compare(const res2term *a, const res2term *b) const
res2term * mult_by_coefficient(const res2term *f, const ring_elem c) const
void elem_text_out(buffer &o, const res2term *f) const
res2term * mult_by_term(const res2term *f, ring_elem c, const int *m) const
vec to_vector(const res2term *f, const FreeModule *F, int to_minimal=0) const
res2term * new_term() const
void remove(res2term *&f) const
static CanonicalForm base
FreeModule — finite-rank free module R^n, the type-level anchor for every Matrix.
vecHeap — geometric heap specialised for accumulating vec values.
VALGRIND_MAKE_MEM_DEFINED & result(result)
PolynomialRing — abstract polynomial-ring base, the engine's most-reused class.
Singly linked-list node carrying one term of a polynomial-ring element.
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.