5 #include "../Monomial.h"
7 #include "../MultivariatePolynomial.h"
11 template<
typename Numeric>
15 CARL_LOG_TRACE(
"carl.core.intervalevaluation",
"Iterating over " << m);
18 CARL_LOG_TRACE(
"carl.core.intervalevaluation",
"Iterating: " << m[i].first);
20 CARL_LOG_ASSERT(
"carl.core.intervalevaluation", map.count(m[i].first) > (
size_t)0,
"Every variable is expected to be in the map.");
21 result *=
carl::pow(map.at(m[i].first), m[i].second);
28 template<
typename Coeff,
typename Numeric, EnableIf<std::is_same<Numeric, Coeff>> = dummy>
37 template<
typename Coeff,
typename Numeric, DisableIf<std::is_same<Numeric, Coeff>> = dummy>
38 inline Interval<Numeric>
evaluate(
const Term<Coeff>& t,
const std::map<Variable, Interval<Numeric>>& map)
40 Interval<Numeric> result(t.coeff());
42 result *=
evaluate( *t.monomial(), map );
46 template<
typename Coeff,
typename Policy,
typename Ordering,
typename Numeric>
49 CARL_LOG_FUNC(
"carl.core.intervalevaluation", p <<
", " << map);
54 for (
unsigned i = 1; i < p.
nr_terms(); ++i) {
63 template<
typename Numeric,
typename Coeff, EnableIf<std::is_same<Numeric, Coeff>> = dummy>
65 CARL_LOG_FUNC(
"carl.core.intervalevaluation", p <<
", " << map);
70 for (
unsigned i = 0; i < p.
degree(); i++) {
74 exp = varValue.pow(i+1);
79 template<
typename Numeric,
typename Coeff, DisableIf<std::is_same<Numeric, Coeff>> = dummy>
80 inline Interval<Numeric>
evaluate(
const UnivariatePolynomial<Coeff>& p,
const std::map<Variable, Interval<Numeric>>& map) {
81 CARL_LOG_FUNC(
"carl.core.intervalevaluation", p <<
", " << map);
82 assert(map.count(p.main_var()) > 0);
84 const Interval<Numeric>& varValue = map.at(p.main_var());
85 Interval<Numeric>
exp(1);
86 for (
uint i = 0; i <= p.degree(); i++) {
88 if( res.is_infinite() )
#define CARL_LOG_FUNC(channel, args)
#define CARL_LOG_TRACE(channel, msg)
#define CARL_LOG_ASSERT(channel, condition, msg)
carl is the main namespace for the library.
Interval< Number > exp(const Interval< Number > &i)
bool is_zero(const Interval< Number > &i)
Check if this interval is a point-interval containing 0.
bool evaluate(const BasicConstraint< Poly > &c, const Assignment< Number > &m)
Interval< Number > pow(const Interval< Number > &i, Integer exp)
auto & get(const std::string &name)
A Variable represents an algebraic variable that can be used throughout carl.
The class which contains the interval arithmetic including trigonometric functions.
static Interval< Number > empty_interval()
Method which returns the empty interval rooted at 0.
bool is_infinite() const
Function which determines, if the interval is (-oo,oo).
bool is_zero() const
Function which determines, if the interval is the zero interval.
This class represents a univariate polynomial with coefficients of an arbitrary type.
const std::vector< Coefficient > & coefficients() const &
Retrieves the coefficients defining this polynomial.
Variable main_var() const
Retrieves the main variable of this polynomial.
uint degree() const
Get the maximal exponent of the main variable.
The general-purpose multivariate polynomial class.
std::size_t nr_terms() const
Calculate the number of terms.
The general-purpose monomials.
std::size_t num_variables() const
Returns the number of variables that occur in the monomial.
Coefficient & coeff()
Get the coefficient.
Monomial::Arg & monomial()
Get the monomial.