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

◆ get_logical_coeff()

ring_elem PolyRing::get_logical_coeff ( const Ring * coeffR,
const Nterm *& f ) const
protected

Definition at line 1701 of file poly.cpp.

1710{
1711 if (f == nullptr) return coeffR->zero();
1712 if (coeffR == K_)
1713 {
1714 ring_elem result = f->coeff;
1715 f = f->next;
1716 return result;
1717 }
1718 const PolynomialRing *KR = coeffR->cast_to_PolynomialRing();
1719 assert(KR);
1720 const PolyRing *K = KR->getNumeratorRing();
1721 Nterm head;
1722 Nterm *inresult = &head;
1723 inresult->next = nullptr;
1726 int nvars = n_vars() - K->n_vars();
1727 M_->to_expvector(f->monom, exp);
1728 exponents::copy(n_vars(), exp, exp2);
1729 do
1730 {
1731 Nterm *t = K->new_term();
1732 inresult->next = t;
1733 inresult = t;
1734 t->coeff = f->coeff;
1735 K->getMonoid()->from_expvector(exp2 + nvars, t->monom);
1736
1737 f = f->next;
1738 if (f == nullptr) break;
1739 M_->to_expvector(f->monom, exp2);
1740 }
1741 while (EQ == exponents::lex_compare(nvars, exp, exp2));
1742 inresult->next = nullptr;
1743 return head.next;
1744}
exponents::Exponents exponents_t
static void copy(int nvars, ConstExponents a, Exponents result)
static int lex_compare(int nvars, ConstExponents a, ConstExponents b)
void from_expvector(const_exponents exp, monomial result) const
Definition monoid.cpp:742
Nterm * new_term() const
Definition poly.cpp:146
PolyRing()
Definition poly.hpp:82
const Ring * K_
Definition polyring.hpp:123
virtual const Monoid * getMonoid() const
Definition polyring.hpp:282
const Monoid * M_
Definition polyring.hpp:124
virtual const PolyRing * getNumeratorRing() const
Definition polyring.hpp:259
int n_vars() const
Definition polyring.hpp:196
ring_elem zero() const
Definition ring.hpp:359
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition ring.hpp:243
VALGRIND_MAKE_MEM_DEFINED & result(result)
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
#define newarray_atomic(T, len)
Definition newdelete.hpp:91
Nterm * next
Definition ringelem.hpp:157
ring_elem coeff
Definition ringelem.hpp:158
int monom[1]
Definition ringelem.hpp:160
const int EQ
Definition style.hpp:40

References Nterm::coeff, ExponentVector< int, true >::copy(), EQ, Monoid::from_expvector(), PolynomialRing::getMonoid(), PolynomialRing::getNumeratorRing(), PolynomialRing::K_, ExponentVector< int, true >::lex_compare(), PolynomialRing::M_, Nterm::monom, PolynomialRing::n_vars(), new_term(), newarray_atomic, Nterm::next, PolynomialRing::PolynomialRing(), PolyRing(), result(), and Ring::Ring().

Referenced by get_coeff(), lead_logical_coeff(), and list_form().