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

◆ promote()

bool M2FreeAlgebraQuotient::promote ( const Ring * R,
const ring_elem f,
ring_elem & result ) const
virtual

Implements Ring.

Definition at line 102 of file M2FreeAlgebraQuotient.cpp.

103{
104 // std::cout << "called promote NC case" << std::endl;
105 // Currently the only case to handle is R = A --> this, and A is the coefficient ring of this.
106 if (R == coefficientRing())
107 {
109 return true;
110 }
111 if (R == &m2FreeAlgebra())
112 {
113 auto f = reinterpret_cast<const Poly*>(f1.get_Poly());
114 auto resultf = new Poly;
115 freeAlgebraQuotient().copy(*resultf, *f);
117 result = ring_elem(reinterpret_cast<void *>(resultf));
118 return true;
119 }
120 return false;
121}
Polynomial< CoefficientRingType > Poly
void copy(Poly &result, const Poly &f) const
void normalizeInPlace(Poly &f) const
const FreeAlgebraQuotient & freeAlgebraQuotient() const
virtual ring_elem from_coefficient(const ring_elem a) const
const Ring * coefficientRing() const
const M2FreeAlgebra & m2FreeAlgebra() const
VALGRIND_MAKE_MEM_DEFINED & result(result)

References coefficientRing(), FreeAlgebraQuotient::copy(), freeAlgebraQuotient(), from_coefficient(), ring_elem::get_Poly(), m2FreeAlgebra(), FreeAlgebraQuotient::normalizeInPlace(), result(), and Ring::Ring().