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

◆ from_varpower_monomial()

void ResMonoidDense::from_varpower_monomial ( res_const_varpower_monomial m,
component_index comp,
res_packed_monomial result ) const
inline

Definition at line 246 of file res-moninfo-dense.hpp.

249 {
250 // 'result' must have enough space allocated
252 result[0] = 0;
253 result[1] = comp;
254 for (int i = 2; i < nslots; i++)
255 {
256 result[i] = 0;
257 }
258 for (index_res_varpower_monomial j = m; j.valid(); ++j)
259 {
260 res_varpower_word v = j.var();
261 res_varpower_word e = j.exponent();
262 result[firstvar + v] = e;
263 if (e == 1)
264 result[0] += hashfcn[v];
265 else
266 result[0] += e * hashfcn[v];
267 }
268
269 const int* wt = weight_vectors.data();
270 for (int j = 0; j < nweights; j++, wt += nvars)
271 {
272 res_monomial_word val = 0;
273 for (index_res_varpower_monomial i = m; i.valid(); ++i)
274 {
275 auto v = i.var();
276 auto e = i.exponent();
277 auto w = wt[v];
278 if (e == 1)
279 val += w;
280 else
281 val += w * e;
282 result[2 + j] = val;
283 }
284 }
285 }
std::unique_ptr< res_monomial_word[]> hashfcn
std::vector< int > weight_vectors
unsigned long ncalls_from_varpower
VALGRIND_MAKE_MEM_DEFINED & result(result)
ExponentListIterator< myword, false > index_res_varpower_monomial
myword res_monomial_word
res_varpower_monomials::Exponent res_varpower_word

References firstvar, hashfcn, ncalls_from_varpower, nslots, nvars, nweights, result(), and weight_vectors.

Referenced by SchreyerFrame::computeIdealQuotient().