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

◆ get_part()

ring_elem PolyRing::get_part ( const std::vector< int > & wts,
const ring_elem f,
bool lobound_given,
bool hibound_given,
long lobound,
long hibound ) const
virtual

Implements PolynomialRing.

Definition at line 1855 of file poly.cpp.

1861{
1862 Nterm head;
1863 Nterm *inresult = &head;
1864
1865 exponents_t exp = newarray_atomic(int, M_->n_vars());
1866
1867 for (Nterm& t : f)
1868 {
1869 M_->to_expvector(t.monom, exp);
1870 long wt = exponents::weight(M_->n_vars(), exp, wts);
1871 if (lobound_given && wt < lobound) continue;
1872 if (hibound_given && wt > hibound) continue;
1873 inresult->next = copy_term(&t);
1874 inresult = inresult->next;
1875 }
1876
1877 inresult->next = nullptr;
1878 freemem(exp);
1879 return head.next;
1880}
exponents::Exponents exponents_t
static Exponent weight(int nvars, ConstExponents a, const std::vector< Exponent > &wts)
Nterm * copy_term(const Nterm *t) const
Definition poly.cpp:161
const Monoid * M_
Definition polyring.hpp:124
void freemem(void *s)
Definition m2-mem.cpp:103
const mpreal exp(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition mpreal.h:2298
#define newarray_atomic(T, len)
Definition newdelete.hpp:91
Nterm * next
Definition ringelem.hpp:157

References copy_term(), freemem(), PolynomialRing::M_, newarray_atomic, Nterm::next, and ExponentVector< int, true >::weight().