A polynomial solver. More...
Public Types | |
typedef Matrix< Scalar, Deg_, Deg_ > | CompanionMatrixType |
typedef std::conditional_t< NumTraits< Scalar >::IsComplex, Scalar, std::complex< Scalar > > | ComplexScalar |
typedef std::conditional_t< NumTraits< Scalar >::IsComplex, ComplexEigenSolver< CompanionMatrixType >, EigenSolver< CompanionMatrixType > > | EigenSolverType |
typedef PolynomialSolverBase< Scalar_, Deg_ > | PS_Base |
Public Types inherited from Eigen::PolynomialSolverBase< Scalar_, Deg_ > | |
typedef DenseIndex | Index |
typedef NumTraits< Scalar >::Real | RealScalar |
typedef Matrix< RootType, Deg_, 1 > | RootsType |
typedef std::complex< RealScalar > | RootType |
typedef Scalar_ | Scalar |
Public Member Functions | |
template<typename OtherPolynomial > | |
void | compute (const OtherPolynomial &poly) |
PolynomialSolver () | |
template<typename OtherPolynomial > | |
PolynomialSolver (const OtherPolynomial &poly) | |
Public Member Functions inherited from Eigen::PolynomialSolverBase< Scalar_, Deg_ > | |
const RealScalar & | absGreatestRealRoot (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const |
const RealScalar & | absSmallestRealRoot (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const |
const RealScalar & | greatestRealRoot (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const |
const RootType & | greatestRoot () const |
PolynomialSolverBase () | |
template<typename OtherPolynomial > | |
PolynomialSolverBase (const OtherPolynomial &poly) | |
template<typename Stl_back_insertion_sequence > | |
void | realRoots (Stl_back_insertion_sequence &bi_seq, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const |
const RootsType & | roots () const |
const RealScalar & | smallestRealRoot (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const |
const RootType & | smallestRoot () const |
Protected Attributes | |
EigenSolverType | m_eigenSolver |
RootsType | m_roots |
Protected Attributes inherited from Eigen::PolynomialSolverBase< Scalar_, Deg_ > | |
RootsType | m_roots |
Additional Inherited Members | |
Protected Member Functions inherited from Eigen::PolynomialSolverBase< Scalar_, Deg_ > | |
template<typename squaredNormBinaryPredicate > | |
const RootType & | selectComplexRoot_withRespectToNorm (squaredNormBinaryPredicate &pred) const |
template<typename squaredRealPartBinaryPredicate > | |
const RealScalar & | selectRealRoot_withRespectToAbsRealPart (squaredRealPartBinaryPredicate &pred, bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const |
template<typename RealPartBinaryPredicate > | |
const RealScalar & | selectRealRoot_withRespectToRealPart (RealPartBinaryPredicate &pred, bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const |
template<typename OtherPolynomial > | |
void | setPolynomial (const OtherPolynomial &poly) |
A polynomial solver.
Computes the complex roots of a real polynomial.
Scalar_ | the scalar type, i.e., the type of the polynomial coefficients |
Deg_ | the degree of the polynomial, can be a compile time value or Dynamic. Notice that the number of polynomial coefficients is Deg_+1. |
This class implements a polynomial solver and provides convenient methods such as
WARNING: this polynomial solver is experimental, part of the unsupported Eigen modules.
Currently a QR algorithm is used to compute the eigenvalues of the companion matrix of the polynomial to compute its roots. This supposes that the complex moduli of the roots are all distinct: e.g. there should be no multiple roots or conjugate roots for instance. With 32bit (float) floating types this problem shows up frequently. However, almost always, correct accuracy is reached even in these cases for 64bit (double) floating types and small polynomial degree (<20).
Definition at line 333 of file PolynomialSolver.h.
typedef Matrix<Scalar,Deg_,Deg_> Eigen::PolynomialSolver< Scalar_, Deg_ >::CompanionMatrixType |
Definition at line 341 of file PolynomialSolver.h.
typedef std::conditional_t<NumTraits<Scalar>::IsComplex, Scalar, std::complex<Scalar> > Eigen::PolynomialSolver< Scalar_, Deg_ >::ComplexScalar |
Definition at line 345 of file PolynomialSolver.h.
typedef std::conditional_t<NumTraits<Scalar>::IsComplex, ComplexEigenSolver<CompanionMatrixType>, EigenSolver<CompanionMatrixType> > Eigen::PolynomialSolver< Scalar_, Deg_ >::EigenSolverType |
Definition at line 344 of file PolynomialSolver.h.
typedef PolynomialSolverBase<Scalar_,Deg_> Eigen::PolynomialSolver< Scalar_, Deg_ >::PS_Base |
Definition at line 338 of file PolynomialSolver.h.
|
inline |
Definition at line 389 of file PolynomialSolver.h.
|
inline |
Definition at line 392 of file PolynomialSolver.h.
|
inline |
Computes the complex roots of a new polynomial.
Definition at line 350 of file PolynomialSolver.h.
|
protected |
Definition at line 396 of file PolynomialSolver.h.
|
protected |
Definition at line 292 of file PolynomialSolver.h.