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

◆ set_degrees()

void Monoid::set_degrees ( )
private

sets mHeftDegrees and mDegreeOfVar

Definition at line 182 of file monoid.cpp.

183{
184 if (mDegreeMonoid == nullptr)
185 {
186 mDegreeOfVar.push_back(static_cast<const_monomial>(nullptr));
187 return;
188 }
189
190 auto degrk = mDegreeMonoid->n_vars();
191 auto *iter = mDegrees.data();
192
193 if (mHeftVector.size() != degrk)
194 {
195 ERROR("internal error: mHeftVector.size() == %d != degrk == %d",
196 mHeftVector.size(),
197 degrk);
198 return;
199 }
200 if (degrk > 0)
201 for (int i = 0; i < mVariableCount; i++)
202 {
203 auto d = exponents::weight(degrk, iter, mHeftVector);
204 auto m = mDegreeMonoid->make_one();
205 mDegreeMonoid->from_expvector(iter, m);
206 mDegreeOfVar.push_back(m);
207 mHeftDegrees.push_back(d);
208 iter += degrk;
209 }
210 else
211 {
212 auto m = mDegreeMonoid->make_one();
213 mDegreeOfVar.assign(mVariableCount, m);
214 mHeftDegrees.assign(mVariableCount, 1);
215 }
216 // an extra entry for the degree of the zero element in the degree monoid
217 mDegreeOfVar.push_back(mDegreeMonoid->make_one());
218}
static Exponent weight(int nvars, ConstExponents a, const std::vector< Exponent > &wts)
const std::vector< int > mDegrees
length mVariableCount * (length of a single degree vector)
Definition monoid.hpp:103
const Monoid * mDegreeMonoid
Definition monoid.hpp:90
const int mVariableCount
number of variables
Definition monoid.hpp:99
std::vector< int > mHeftDegrees
length mVariableCount
Definition monoid.hpp:108
gc_vector< const_monomial > mDegreeOfVar
Definition monoid.hpp:113
const std::vector< int > mHeftVector
length of a single degree vector
Definition monoid.hpp:105
const int ERROR
Definition m2-mem.cpp:55
const int * const_monomial
Definition monoid.hpp:59

References ERROR, mDegreeMonoid, mDegreeOfVar, mDegrees, mHeftDegrees, mHeftVector, mVariableCount, and ExponentVector< int, true >::weight().