10 #ifndef EIGEN_POLYNOMIAL_UTILS_H 11 #define EIGEN_POLYNOMIAL_UTILS_H 26 template <
typename Polynomials,
typename T>
30 T val=poly[poly.size()-1];
32 val = val*x + poly[i]; }
44 template <
typename Polynomials,
typename T>
57 val = val*inv_x + poly[i]; }
59 return std::pow(x,(
T)(poly.size()-1)) * val;
73 template <
typename Polynomial>
78 typedef typename Polynomial::Scalar Scalar;
82 const Scalar inv_leading_coeff = Scalar(1)/poly[poly.size()-1];
86 cb +=
abs(poly[i]*inv_leading_coeff); }
96 template <
typename Polynomial>
101 typedef typename Polynomial::Scalar Scalar;
105 while( i<poly.size()-1 && Scalar(0) == poly(i) ){ ++i; }
106 if( poly.size()-1 == i ){
109 const Scalar inv_min_coeff = Scalar(1)/poly[i];
112 cb +=
abs(poly[j]*inv_min_coeff); }
126 template <
typename RootVector,
typename Polynomial>
130 typedef typename Polynomial::Scalar Scalar;
132 poly.setZero( rv.size()+1 );
133 poly[0] = -rv[0]; poly[1] = Scalar(1);
136 for(
DenseIndex j=i+1; j>0; --j ){ poly[j] = poly[j-1] - rv[i]*poly[j]; }
137 poly[0] = -rv[i]*poly[0];
143 #endif // EIGEN_POLYNOMIAL_UTILS_H USING_NAMESPACE_ACADO typedef TaylorVariable< Interval > T
T poly_eval_horner(const Polynomials &poly, const T &x)
T poly_eval(const Polynomials &poly, const T &x)
iterative scaling algorithm to equilibrate rows and column norms in matrices
IntermediateState pow(const Expression &arg1, const Expression &arg2)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > abs2() const
void roots_to_monicPolynomial(const RootVector &rv, Polynomial &poly)
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > abs() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
NumTraits< typename Polynomial::Scalar >::Real cauchy_min_bound(const Polynomial &poly)
NumTraits< typename Polynomial::Scalar >::Real cauchy_max_bound(const Polynomial &poly)