3 #include "../MultivariatePolynomial.h"
4 #include "../UnivariatePolynomial.h"
16 template<
typename C,
typename O,
typename P>
22 for (
const auto& t : p)
24 coeffs[t.tdeg()] = t.coeff();
34 template<
typename C,
typename O,
typename P>
37 std::vector<MultivariatePolynomial<C,O,P>> coeffs(1);
38 for (
const auto& term: p) {
39 if (term.monomial() ==
nullptr) coeffs[0] += term;
41 const auto& mon = term.monomial();
42 auto exponent = mon->exponent_of_variable(v);
46 std::shared_ptr<const carl::Monomial> tmp = mon->drop_variable(v);
47 coeffs[
exponent] += term.coeff() * tmp;
carl is the main namespace for the library.
UnivariatePolynomial< C > to_univariate_polynomial(const MultivariatePolynomial< C, O, P > &p)
Convert a univariate polynomial that is currently (mis)represented by a 'MultivariatePolynomial' into...
std::size_t exponent
Type of an exponent.
void variables(const BasicConstraint< Pol > &c, carlVariables &vars)
A Variable represents an algebraic variable that can be used throughout carl.
This class represents a univariate polynomial with coefficients of an arbitrary type.
The general-purpose multivariate polynomial class.
bool is_consistent() const
Asserts that this polynomial complies with the requirements and assumptions for MultivariatePolynomia...
const Monomial::Arg & lmon() const
The leading monomial.
std::size_t total_degree() const
Calculates the max.