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 resterm *tm = f; tm !=
nullptr; tm = tm->
next)
53 result->coeff =
K->copy(tm->coeff);
54 M->mult(tm->monom, m,
result->monom);
64 for (
const resterm *tm = f; tm !=
nullptr; tm = tm->
next)
69 result->coeff =
K->copy(tm->coeff);
70 M->copy(tm->monom,
result->monom);
92 for (
const resterm *tm = f; tm !=
nullptr; tm = tm->
next)
97 result->coeff =
K->mult(c, tm->coeff);
98 M->mult(tm->monom, m,
result->monom);
115 result->coeff =
K->mult(c, tm.coeff);
116 M->mult(tm.monom, m,
result->monom);
124 if (f ==
nullptr)
return;
127 for (
resterm *tm = f; tm !=
nullptr; tm = tm->
next)
K->mult_to(tm->coeff, c_inv);
134 if (g ==
nullptr)
return;
143 while (1)
switch (
compare(f, g))
174 if (
K->is_zero(tmf->
coeff))
245 bool p_parens =
true;
247 for (
const resterm *t = f; t !=
nullptr; t = t->
next)
249 int isone =
M->is_one(t->monom);
250 K->elem_text_out(o, t->coeff, p_one, p_parens, p_plus);
251 if (!isone)
M->elem_text_out(o, t->monom, p_one);
252 o <<
"<" << t->comp->me <<
">";
263 for (
const resterm *tm = f; tm !=
nullptr; tm = tm->
next)
269 M->divide(tm->monom, tm->comp->base_monom, mon);
271 ring_elem a =
R->make_flat_term(tm->coeff, mon);
272 vec tmp =
R->make_vec(
x, a);
283 for (
vecterm *w = v; w !=
nullptr; w = w->next)
303 for (
const resterm *tm = f; tm !=
nullptr; tm = tm->
next)
309 result->coeff =
K->copy(tm->coeff);
310 M->copy(tm->monom,
result->monom);
319 for (
const resterm *tm = f; tm !=
nullptr; tm = tm->
next)
320 if (tm->comp ==
x)
return tm;
330 if (f ==
nullptr || f->
next ==
nullptr)
return;
340 if (f ==
nullptr)
break;
Engine-side free module R^n over a Ring.
Abstract base for the engine's polynomial-ring hierarchy.
void elem_text_out(buffer &o, const resterm *f) const
resterm * mult_by_term(const resterm *f, ring_elem c, const int *m) const
resterm * copy(const resterm *f) const
resterm * mult_by_monomial(const resterm *f, const int *m) const
int n_terms(const resterm *f) const
int compare(const resterm *a, const resterm *b) const
resterm * from_vector(const VECTOR(res_pair *)&base, const vec v) const
void remove(resterm *&f) const
void sort(resterm *&f) const
res_poly(PolynomialRing *R)
void ring_subtract_multiple_to(resterm *&f, ring_elem c, const int *m, res_pair *x, const ring_elem g) const
vec to_vector(const resterm *f, const FreeModule *F, int to_minimal=0) const
resterm * strip(const resterm *f) const
resterm * ring_mult_by_term(const ring_elem f, ring_elem c, const int *m, res_pair *x) const
const resterm * component_occurs_in(const res_pair *x, const resterm *f) const
void make_monic(resterm *&f) const
void add_to(resterm *&f, resterm *&g) const
void subtract_multiple_to(resterm *&f, ring_elem c, const int *m, const resterm *g) const
resterm * new_term() 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.