10 #ifndef EIGEN_POLYNOMIAL_SOLVER_H 11 #define EIGEN_POLYNOMIAL_SOLVER_H 28 template<
typename _Scalar,
int _Deg >
42 template< typename OtherPolynomial >
47 template<
typename OtherPolynomial >
68 template<
typename Stl_back_insertion_sequence>
69 inline void realRoots( Stl_back_insertion_sequence& bi_seq,
82 template<
typename squaredNormBinaryPredicate>
90 if( pred( currNorm2, norm2 ) ){
91 res=i; norm2=currNorm2; }
102 std::greater<Scalar> greater;
111 std::less<Scalar> less;
116 template<
typename squaredRealPartBinaryPredicate>
118 squaredRealPartBinaryPredicate& pred,
123 hasArealRoot =
false;
140 if( pred( currAbs2, abs2 ) )
157 template<
typename RealPartBinaryPredicate>
159 RealPartBinaryPredicate& pred,
164 hasArealRoot =
false;
181 if( pred( curr, val ) )
216 std::greater<Scalar> greater;
239 std::less<Scalar> less;
262 std::greater<Scalar> greater;
285 std::less<Scalar> less;
293 #define EIGEN_POLYNOMIAL_SOLVER_BASE_INHERITED_TYPES( BASE ) \ 294 typedef typename BASE::Scalar Scalar; \ 295 typedef typename BASE::RealScalar RealScalar; \ 296 typedef typename BASE::RootType RootType; \ 297 typedef typename BASE::RootsType RootsType; 330 template<
typename _Scalar,
int _Deg >
344 template< typename OtherPolynomial >
345 void compute( const OtherPolynomial& poly )
350 m_eigenSolver.compute( companion.denseMatrix() );
351 m_roots = m_eigenSolver.eigenvalues();
355 template<
typename OtherPolynomial >
362 using PS_Base::m_roots;
367 template<
typename _Scalar >
376 template< typename OtherPolynomial >
377 void compute( const OtherPolynomial& poly )
380 m_roots[0] = -poly[0]/poly[poly.size()-1];
384 using PS_Base::m_roots;
389 #endif // EIGEN_POLYNOMIAL_SOLVER_H
const RealScalar & greatestRealRoot(bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
void realRoots(Stl_back_insertion_sequence &bi_seq, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
iterative scaling algorithm to equilibrate rows and column norms in matrices
PolynomialSolverBase< _Scalar, 1 > PS_Base
DerType::Scalar imag(const AutoDiffScalar< DerType > &)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Defined to be inherited by polynomial solvers: it provides convenient methods such as...
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > abs2() const
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > abs() const
const RootType & smallestRoot() const
const RealScalar & smallestRealRoot(bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
const RealScalar & absSmallestRealRoot(bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
#define EIGEN_POLYNOMIAL_SOLVER_BASE_INHERITED_TYPES(BASE)
PolynomialSolver(const OtherPolynomial &poly)
NumTraits< Scalar >::Real RealScalar
const RootType & greatestRoot() const
std::complex< RealScalar > RootType
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
void setPolynomial(const OtherPolynomial &poly)
const RealScalar & absGreatestRealRoot(bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
PolynomialSolverBase(const OtherPolynomial &poly)
const RootsType & roots() const
internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar &x)
EigenSolverType m_eigenSolver
Computes eigenvalues and eigenvectors of general matrices.
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Size)
The matrix class, also used for vectors and row-vectors.
const RealScalar & selectRealRoot_withRespectToAbsRealPart(squaredRealPartBinaryPredicate &pred, bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
const AutoDiffScalar< DerType > & real(const AutoDiffScalar< DerType > &x)
const RealScalar & selectRealRoot_withRespectToRealPart(RealPartBinaryPredicate &pred, bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
const RootType & selectComplexRoot_withRespectToNorm(squaredNormBinaryPredicate &pred) const