4 #include "../UnivariatePolynomial.h"
9 namespace detail_sign_variations {
16 template<
typename Coefficient>
18 std::vector<Coefficient> coeffs(std::move(p.coefficients()));
29 template<
typename Coefficient>
31 std::vector<Coefficient> coeffs(std::move(p.coefficients()));
32 Coefficient f = factor;
33 for (
auto& c: coeffs) {
46 template<
typename Coefficient>
48 std::vector<Coefficient> next;
52 for (std::size_t i = 0; i < p.
coefficients().size()-1; i++) {
53 next.push_back(next.back());
54 for (std::size_t j = i; j > 0; j--) {
55 next[j] = a * next[j] + next[j-1];
71 template<
typename Coefficient>
75 std::vector<Coefficient> vals;
78 vals.push_back(c * factor);
79 factor *= interval.
lower();
81 auto res =
carl::sign_variations(vals.begin(), vals.end(), [](
const auto& c){ return carl::sgn(c); });
82 CARL_LOG_TRACE(
"carl.core", polynomial <<
" has " << res <<
" sign variations at " << interval.
lower());
93 CARL_LOG_TRACE(
"carl.core", polynomial <<
" has " << res <<
" sign variations within " << interval);
#define CARL_LOG_TRACE(channel, msg)
carl is the main namespace for the library.
std::size_t sign_variations(InputIterator begin, InputIterator end)
Counts the number of sign variations in the given object range.
UnivariatePolynomial< Coefficient > reverse(UnivariatePolynomial< Coefficient > &&p)
Reverses the order of the coefficients of this polynomial.
UnivariatePolynomial< Coefficient > shift(const UnivariatePolynomial< Coefficient > &p, const Coefficient &a)
Shift the variable by a, i.e.
UnivariatePolynomial< Coefficient > scale(UnivariatePolynomial< Coefficient > &&p, const Coefficient &factor)
Scale the variable, i.e.
The class which contains the interval arithmetic including trigonometric functions.
bool is_empty() const
Function which determines, if the interval is empty.
const Number & lower() const
The getter for the lower boundary of the interval.
bool is_point_interval() const
Function which determines, if the interval is a pointinterval.
Number diameter() const
Returns the diameter of the 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.
bool is_consistent() const
Asserts that this polynomial over numeric coefficients complies with the requirements and assumptions...
void strip_leading_zeroes()