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

◆ GRevLex() [2/3]

MonomialOrdering * MonomialOrderings::GRevLex ( const std::vector< int > & wts,
int packing )
static

Definition at line 162 of file monomial-ordering.cpp.

164{
165 MonomialOrdering *result;
166 mon_part p;
167 enum MonomialOrdering_type typ;
168 const int *wts;
169 bool all_one = true;
170 for (int i = 0; i < degs.size(); i++)
171 if (degs[i] <= 0)
172 {
173 ERROR("grevlex: expected all degrees to be positive");
174 return nullptr;
175 }
176 else if (degs[i] > 1)
177 all_one = false;
178
179 if (all_one)
180 {
181 if (packing == 2)
182 typ = MO_GREVLEX2;
183 else if (packing == 4)
184 typ = MO_GREVLEX4;
185 else
186 typ = MO_GREVLEX;
187 wts = nullptr;
188 }
189 else
190 {
191 if (packing == 2)
192 typ = MO_GREVLEX2_WTS;
193 else if (packing == 4)
194 typ = MO_GREVLEX4_WTS;
195 else
196 typ = MO_GREVLEX_WTS;
197 wts = degs.data();
198 }
199
200 p = mo_make(typ, degs.size(), wts);
202 result->array[0] = p;
203 return result;
204}
int p
const int ERROR
Definition m2-mem.cpp:55
VALGRIND_MAKE_MEM_DEFINED & result(result)
static struct mon_part_rec_ * mo_make(enum MonomialOrdering_type type, int nvars, const int *wts)
static MonomialOrdering * make_mon_order(int n)
MonomialOrdering_type
@ MO_GREVLEX4_WTS
@ MO_GREVLEX
@ MO_GREVLEX4
@ MO_GREVLEX2_WTS
@ MO_GREVLEX2
@ MO_GREVLEX_WTS

References ERROR, make_mon_order(), MO_GREVLEX, MO_GREVLEX2, MO_GREVLEX2_WTS, MO_GREVLEX4, MO_GREVLEX4_WTS, MO_GREVLEX_WTS, mo_make(), p, and result().