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

◆ getMonomial()

void FreeMonoid::getMonomial ( Monom monom,
std::vector< int > & result ) const

Definition at line 204 of file FreeMonoid.cpp.

210{
211 auto start = result.size();
212 result.push_back(0);
213
214 auto word_length = wordLength(m);
215 auto word_ptr = m + mNumWeights + 1;
216 for (auto j = 0; j < word_length; j++)
217 {
218 int curvar = word_ptr[j];
219 int curvarPower = 0;
220 result.push_back(curvar);
221 while ((j < word_length) && (word_ptr[j] == curvar))
222 {
223 j++;
224 curvarPower++;
225 }
226 result.push_back(curvarPower);
227 // back j up one since we went too far looking ahead.
228 --j;
229 }
230 result[start] = static_cast<int>(result.size() - start);
231}
const int mNumWeights
int wordLength(const Monom &m) const
VALGRIND_MAKE_MEM_DEFINED & result(result)

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