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

◆ toMonomial()

void ResMonomialSorter::toMonomial ( res_packed_monomial mon,
std::pair< int *, int * > resultAlreadyAllocateds )
inlineprivate

Definition at line 193 of file res-monomial-sorter.hpp.

194 {
195 int comp, comp2;
196 int nvars = mMonoid.n_vars();
197 std::pair<int*, int*> exp = mArena.allocArrayNoCon<int>(nvars);
198 std::pair<int*, int*> exp2 = mArena.allocArrayNoCon<int>(nvars);
199 mResMonoid.to_expvector(mon, exp.first, comp);
200 mResMonoid.to_expvector(mSchreyerOrder.mTotalMonom[comp], exp2.first, comp2);
201 exponents::mult(nvars, exp.first, exp2.first, exp2.first);
202 auto p = resultAlreadyAllocateds.first;
203 *p++ = mSchreyerOrder.mTieBreaker[comp];
204 *p++ = comp2;
205 mMonoid.from_expvector(exp2.first, p);
206 mArena.freeTop(exp2.first); // note: can only pop one at a time from an mt::Arena!
207 mArena.freeTop(exp.first);
208 }
static void mult(int nvars, ConstExponents a, ConstExponents b, Exponents result)
const ResSchreyerOrder & mSchreyerOrder
const ResMonoid & mResMonoid
int p
const mpreal exp2(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition mpreal.h:2299
const mpreal exp(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition mpreal.h:2298

References mArena, mMonoid, mResMonoid, mSchreyerOrder, ExponentVector< int, true >::mult(), and p.

Referenced by setMonoms().