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

◆ get_terms() [1/2]

Poly * M2FreeAlgebra::get_terms ( const Poly * f,
int lo,
int hi ) const

Definition at line 395 of file M2FreeAlgebra.cpp.

396{
397 auto result = new Poly;
398 auto& outcoeff = result->getCoeffInserter();
399 auto& outmonom = result->getMonomInserter();
400 int which = 0;
401 for(auto i=f->cbegin(); i != f->cend() and which <= hi; ++i, ++which)
402 {
403 if (which < lo) continue;
404 outcoeff.push_back(i.coeff());
405 monoid().copy(i.monom(), outmonom);
406 }
407 return result;
408}
Polynomial< CoefficientRingType > Poly
void copy(const Monom &m, MonomialInserter &result) const
const FreeMonoid & monoid() const
VALGRIND_MAKE_MEM_DEFINED & result(result)

References FreeMonoid::copy(), monoid(), and result().

Referenced by get_terms(), M2FreeAlgebraQuotient::get_terms(), M2FreeAlgebraQuotient::get_terms(), and RingElement::get_terms().