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

◆ mult()

void FreeAlgebra::mult ( Poly & result,
const Poly & f,
const Poly & g ) const

Definition at line 503 of file FreeAlgebra.cpp.

504{
505 FreeAlgebraHeap H {*this};
506 Poly tmp;
507 init(tmp);
508 if (f.numTerms() <= g.numTerms())
509 {
510 for (auto fIt = f.cbegin(); fIt != f.cend(); fIt++)
511 {
512 mult_by_term_left(tmp, g, fIt.coeff(), fIt.monom());
513 H.add(tmp);
514 setZero(tmp);
515 }
516 }
517 else
518 {
519 for (auto gIt = g.cbegin(); gIt != g.cend(); gIt++)
520 {
521 mult_by_term_right(tmp,f, gIt.coeff(), gIt.monom());
522 H.add(tmp);
523 setZero(tmp);
524 }
525 }
526 H.value(result);
527 clear(tmp);
528}
Polynomial< CoefficientRingType > Poly
void mult_by_term_right(Poly &result, const Poly &f, const ring_elem c, const Monom m) const
void mult_by_term_left(Poly &result, const Poly &f, const ring_elem c, const Monom m) const
void init(Poly &f) const
void clear(Poly &f) const
void setZero(Poly &f) const
void value(Poly &result)
void add(const Poly &f)
VALGRIND_MAKE_MEM_DEFINED & result(result)

References FreeAlgebraHeap::add(), clear(), init(), mult_by_term_left(), mult_by_term_right(), result(), setZero(), and FreeAlgebraHeap::value().

Referenced by M2FreeAlgebra::mult(), mult_by_coeff(), and power().