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

◆ from_expvector()

bool ResMonoidDense::from_expvector ( res_const_ntuple_monomial e,
component_index comp,
res_packed_monomial result ) const
inline

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

162 {
163 // Pack the vector e[0]..e[nvars-1],comp. Create the hash value at the same
164 // time.
166 result[0] = 0;
167 result[1] = comp;
168
169 for (int i = 0; i < nvars; i++)
170 {
171 result[firstvar + i] = e[i];
172 if (e[i] > 0) result[0] += hashfcn[i] * e[i];
173 }
174
175 const int* wt = weight_vectors.data();
176 for (int j = 0; j < nweights; j++, wt += nvars)
177 {
178 res_monomial_word val = 0;
179 for (int i = 0; i < nvars; i++)
180 {
181 auto a = e[i];
182 if (a > 0) val += a * wt[i];
183 }
184 result[2 + j] = val;
185 }
186 return true;
187 }
std::unique_ptr< res_monomial_word[]> hashfcn
unsigned long ncalls_from_expvector
std::vector< int > weight_vectors
VALGRIND_MAKE_MEM_DEFINED & result(result)
myword res_monomial_word

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

Referenced by ResF4toM2Interface::from_M2_vec().