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

◆ from_expvector()

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

Definition at line 183 of file res-moninfo-sparse.hpp.

186 {
187 // Pack the vector e[0]..e[mNumVars-1],comp. Create the hash value at the
188 // same time.
190 result[0] = 0; // length
191 result[1] = 0; // hash value, not set here (other than this...)
192 result[2] = comp; // component
193
194 int next_var_slot = mFirstVar;
195
196 for (int i = mNumVars - 1; i >= 0; --i)
197 {
198 if (e[i] > 0)
199 {
200 for (int j = 0; j < e[i]; j++)
201 {
202 result[1] += hashfcn[i];
203 result[next_var_slot] = i;
204 next_var_slot++;
205 }
206 }
207 }
208 result[0] = next_var_slot; // this is the length of this monomial
210 return true;
211 }
unsigned long ncalls_from_expvector
void setWeightAndHash(res_packed_monomial result) const
std::unique_ptr< res_monomial_word[]> hashfcn
VALGRIND_MAKE_MEM_DEFINED & result(result)

References hashfcn, mFirstVar, mNumVars, ncalls_from_expvector, result(), and setWeightAndHash().