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

◆ fromMonomial()

void FreeMonoid::fromMonomial ( const_monomial monom,
MonomialInserter & result ) const

Definition at line 262 of file FreeMonoid.cpp.

267{
268 int inputMonomLength = *monom;
269 int startMon = static_cast<int>(result.size());
270 // make space for the length and the weights
271 for (int i=0; i<mNumWeights+1; ++i)
272 result.push_back(0);
273 for (int j = inputMonomLength-2; j >= 1; j -= 2)
274 {
275 auto v = monom[j];
276 for (int k = 0; k < monom[j+1]; k++)
277 {
278 result.push_back(v);
279 }
280 }
281 result[startMon] = static_cast<int>(result.size() - startMon);
282 Monom tmpMon(result.data()+startMon);
283 setWeights(tmpMon);
284}
const int mNumWeights
void setWeights(Monom &m) const
VALGRIND_MAKE_MEM_DEFINED & result(result)

References mNumWeights, result(), and setWeights().

Referenced by M2FreeAlgebra::makeTerm().