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

◆ autoreduceByLastElement()

void NCGroebner::autoreduceByLastElement ( )

Definition at line 204 of file NCGroebner.cpp.

205{
206 if (mGroebner.size() <= 1) return;
207 const Poly& lastPoly = *(mGroebner[mGroebner.size()-1]);
208 Monom leadMon = lastPoly.cbegin().monom();
209 for (auto fPtr = mGroebner.begin(); fPtr != mGroebner.end() - 1; ++fPtr)
210 {
211 ring_elem foundCoeff = getCoeffOfMonom(**fPtr,leadMon);
212 if (!freeAlgebra().coefficientRing()->is_zero(foundCoeff))
213 {
214 Poly* result = new Poly;
215 freeAlgebra().subtractScalarMultipleOf(*result,**fPtr,lastPoly,foundCoeff);
216 freeAlgebra().swap(**fPtr,*result);
217 }
218 }
219}
Polynomial< CoefficientRingType > Poly
void subtractScalarMultipleOf(Poly &result, const Poly &f, const Poly &g, ring_elem coeff) const
void swap(Poly &f, Poly &g) const
PolyList mGroebner
const FreeAlgebra & freeAlgebra() const
ring_elem getCoeffOfMonom(const Poly &f, const Monom &m)
VALGRIND_MAKE_MEM_DEFINED & result(result)

References freeAlgebra(), getCoeffOfMonom(), mGroebner, result(), FreeAlgebra::subtractScalarMultipleOf(), and FreeAlgebra::swap().

Referenced by computeHomogeneous(), and computeInhomogeneous().