10 #ifndef EIGEN_POLYNOMIAL_SOLVER_H
11 #define EIGEN_POLYNOMIAL_SOLVER_H
30 template<
typename Scalar_,
int Deg_ >
44 template< typename OtherPolynomial >
49 template<
typename OtherPolynomial >
70 template<
typename Stl_back_insertion_sequence>
71 inline void realRoots( Stl_back_insertion_sequence& bi_seq,
84 template<
typename squaredNormBinaryPredicate>
92 if( pred( currNorm2, norm2 ) ){
93 res=
i; norm2=currNorm2; }
104 std::greater<RealScalar> greater;
113 std::less<RealScalar> less;
118 template<
typename squaredRealPartBinaryPredicate>
120 squaredRealPartBinaryPredicate& pred,
125 hasArealRoot =
false;
142 if( pred( currAbs2,
abs2 ) )
149 else if(!hasArealRoot)
159 template<
typename RealPartBinaryPredicate>
161 RealPartBinaryPredicate& pred,
166 hasArealRoot =
false;
183 if( pred( curr, val ) )
218 std::greater<RealScalar> greater;
241 std::less<RealScalar> less;
264 std::greater<RealScalar> greater;
287 std::less<RealScalar> less;
295 #define EIGEN_POLYNOMIAL_SOLVER_BASE_INHERITED_TYPES( BASE ) \
296 typedef typename BASE::Scalar Scalar; \
297 typedef typename BASE::RealScalar RealScalar; \
298 typedef typename BASE::RootType RootType; \
299 typedef typename BASE::RootsType RootsType;
332 template<
typename Scalar_,
int Deg_>
349 template< typename OtherPolynomial >
356 internal::companion<Scalar,Deg_> companion( poly );
380 else if(poly.size () == 2)
388 template<
typename OtherPolynomial >
400 template<
typename Scalar_ >
409 template<
typename OtherPolynomial >
418 template<
typename OtherPolynomial >
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Size)
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
#define EIGEN_POLYNOMIAL_SOLVER_BASE_INHERITED_TYPES(BASE)
constexpr void resize(Index rows, Index cols)
Defined to be inherited by polynomial solvers: it provides convenient methods such as.
void setPolynomial(const OtherPolynomial &poly)
const RealScalar & selectRealRoot_withRespectToRealPart(RealPartBinaryPredicate &pred, bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
PolynomialSolverBase(const OtherPolynomial &poly)
const RootType & greatestRoot() const
std::complex< RealScalar > RootType
const RootType & smallestRoot() const
const RootType & selectComplexRoot_withRespectToNorm(squaredNormBinaryPredicate &pred) const
const RealScalar & greatestRealRoot(bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
const RealScalar & selectRealRoot_withRespectToAbsRealPart(squaredRealPartBinaryPredicate &pred, 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
const RealScalar & smallestRealRoot(bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
NumTraits< Scalar >::Real RealScalar
const RealScalar & absSmallestRealRoot(bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
const RealScalar & absGreatestRealRoot(bool &hasArealRoot, const RealScalar &absImaginaryThreshold=NumTraits< Scalar >::dummy_precision()) const
const RootsType & roots() const
void compute(const OtherPolynomial &poly)
PolynomialSolverBase< Scalar_, 1 > PS_Base
PolynomialSolver(const OtherPolynomial &poly)
EigenSolverType m_eigenSolver
void compute(const OtherPolynomial &poly)
PolynomialSolver(const OtherPolynomial &poly)
std::conditional_t< NumTraits< Scalar >::IsComplex, ComplexEigenSolver< CompanionMatrixType >, EigenSolver< CompanionMatrixType > > EigenSolverType
std::conditional_t< NumTraits< Scalar >::IsComplex, Scalar, std::complex< Scalar > > ComplexScalar
T poly_eval(const Polynomials &poly, const T &x)
bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
internal::add_const_on_value_type_t< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) > real_ref(const Scalar &x)
EIGEN_ALWAYS_INLINE std::enable_if_t< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real > abs(const T &x)
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_imag_op< typename Derived::Scalar >, const Derived > imag(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_abs2_op< typename Derived::Scalar >, const Derived > abs2(const Eigen::ArrayBase< Derived > &x)
Eigen::AutoDiffScalar< EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(internal::remove_all_t< DerType >, typename internal::traits< internal::remove_all_t< DerType >>::Scalar, product) > pow(const Eigen::AutoDiffScalar< DerType > &x, const typename internal::traits< internal::remove_all_t< DerType >>::Scalar &y)
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_real_op< typename Derived::Scalar >, const Derived > real(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_abs_op< typename Derived::Scalar >, const Derived > abs(const Eigen::ArrayBase< Derived > &x)
adouble abs(const adouble &x)
const adouble & real(const adouble &x)
adouble imag(const adouble &)