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]; }
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 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half pow(const half &a, const half &b)
T poly_eval_horner(const Polynomials &poly, const T &x)
T poly_eval(const Polynomials &poly, const T &x)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
void roots_to_monicPolynomial(const RootVector &rv, Polynomial &poly)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() 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)