419{
422 if (P == nullptr)
423 {
424 ERROR(
"expected a polynomial ring");
425 return 0;
426 }
427 const int n = P->
n_vars();
432 CanonicalForm f = 0;
434 {
435 int coef = 0;
436 M->to_varpower(t->monom, vp);
437 if (foo.mode == modeZn)
438 {
439 std::pair<bool, long> res = foo.Zn->coerceToLongInteger(t->coeff);
440 assert(res.first);
441 coef = static_cast<int>(res.second);
442 }
443 CanonicalForm m =
445 ? CanonicalForm(coef)
452 mpq_numref(
MPQ_VAL(t->coeff))) /
454 mpq_denref(
MPQ_VAL(t->coeff))))
455 : CanonicalForm(0)
456 );
458 {
459 int index = 1 +
460#if REVERSE_VARIABLES
461 (n - 1) -
462#endif
463 l.var();
464 m *= power(index == 1 && inExtension ? algebraicElement_Fac
465 : Variable(index),
466 l.exponent());
467 }
468 f += m;
469 }
470 return f;
471}
ExponentListIterator< int, true > index_varpower
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
virtual const Monoid * getMonoid() const
Abstract base for the engine's polynomial-ring hierarchy.
virtual const PolynomialRing * cast_to_PolynomialRing() const
ring_elem get_value() const
const Ring * get_ring() const
static CanonicalForm convertToFactory(mpz_srcptr p)
static CanonicalForm convertGFToFactory(const std::vector< long > &repr)
typename std::vector< T, gc_allocator< T > > gc_vector
a version of the STL vector, which allocates its backing memory with gc.
Singly linked-list node carrying one term of a polynomial-ring element.