11 #include <unsupported/Eigen/Polynomials> 19 struct increment_if_fixed_size
28 template<
typename _Scalar,
int _Deg>
31 typedef internal::increment_if_fixed_size<_Deg> Dim;
35 PolynomialType pols(deg+1);
36 EvalRootsType roots = EvalRootsType::Random(deg);
39 EvalRootsType evr( deg );
40 for(
int i=0;
i<roots.size(); ++
i ){
43 bool evalToZero = evr.isZero( test_precision<_Scalar>() );
45 cerr << evr.transpose() << endl; }
51 CALL_SUBTEST_2( (realRoots_to_monicPolynomial_test<_Scalar,2>(2)) );
52 CALL_SUBTEST_3( (realRoots_to_monicPolynomial_test<_Scalar,3>(3)) );
53 CALL_SUBTEST_4( (realRoots_to_monicPolynomial_test<_Scalar,4>(4)) );
54 CALL_SUBTEST_5( (realRoots_to_monicPolynomial_test<_Scalar,5>(5)) );
55 CALL_SUBTEST_6( (realRoots_to_monicPolynomial_test<_Scalar,6>(6)) );
56 CALL_SUBTEST_7( (realRoots_to_monicPolynomial_test<_Scalar,7>(7)) );
57 CALL_SUBTEST_8( (realRoots_to_monicPolynomial_test<_Scalar,17>(17)) );
59 CALL_SUBTEST_9( (realRoots_to_monicPolynomial_test<_Scalar,Dynamic>(
60 internal::random<int>(18,26) )) );
66 template<
typename _Scalar,
int _Deg>
69 typedef internal::increment_if_fixed_size<_Deg> Dim;
73 PolynomialType pols(deg+1);
74 EvalRootsType roots = EvalRootsType::Random(deg);
78 _Scalar Max = roots.array().abs().maxCoeff();
79 _Scalar
min = roots.array().abs().minCoeff();
80 bool eval = (M >= Max) && (m <= min);
83 cerr <<
"Roots: " << roots << endl;
84 cerr <<
"Bounds: (" << m <<
", " << M <<
")" << endl;
85 cerr <<
"Min,Max: (" << min <<
", " << Max <<
")" << endl;
92 CALL_SUBTEST_2( (CauchyBounds<_Scalar,2>(2)) );
93 CALL_SUBTEST_3( (CauchyBounds<_Scalar,3>(3)) );
94 CALL_SUBTEST_4( (CauchyBounds<_Scalar,4>(4)) );
95 CALL_SUBTEST_5( (CauchyBounds<_Scalar,5>(5)) );
96 CALL_SUBTEST_6( (CauchyBounds<_Scalar,6>(6)) );
97 CALL_SUBTEST_7( (CauchyBounds<_Scalar,7>(7)) );
98 CALL_SUBTEST_8( (CauchyBounds<_Scalar,17>(17)) );
100 CALL_SUBTEST_9( (CauchyBounds<_Scalar,Dynamic>(
101 internal::random<int>(18,26) )) );
108 realRoots_to_monicPolynomial_scalar<double>();
109 realRoots_to_monicPolynomial_scalar<float>();
110 CauchyBounds_scalar<double>();
111 CauchyBounds_scalar<float>();
Matrix< RealScalar, Dynamic, Dynamic > M
T poly_eval(const Polynomials &poly, const T &x)
Namespace containing all symbols from the Eigen library.
void test_polynomialutils()
void realRoots_to_monicPolynomial_test(int deg)
void roots_to_monicPolynomial(const RootVector &rv, Polynomial &poly)
void realRoots_to_monicPolynomial_scalar()
void CauchyBounds_scalar()
void CauchyBounds(int deg)
internal::nested_eval< T, 1 >::type eval(const T &xpr)
The matrix class, also used for vectors and row-vectors.
NumTraits< typename Polynomial::Scalar >::Real cauchy_min_bound(const Polynomial &poly)
NumTraits< typename Polynomial::Scalar >::Real cauchy_max_bound(const Polynomial &poly)