MCPcopy Create free account
hub / github.com/abess-team/abess / CauchyBounds

Function CauchyBounds

python/include/unsupported/test/polynomialutils.cpp:67–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66template<typename _Scalar, int _Deg>
67void CauchyBounds(int deg)
68{
69 typedef internal::increment_if_fixed_size<_Deg> Dim;
70 typedef Matrix<_Scalar,Dim::ret,1> PolynomialType;
71 typedef Matrix<_Scalar,_Deg,1> EvalRootsType;
72
73 PolynomialType pols(deg+1);
74 EvalRootsType roots = EvalRootsType::Random(deg);
75 roots_to_monicPolynomial( roots, pols );
76 _Scalar M = cauchy_max_bound( pols );
77 _Scalar m = cauchy_min_bound( pols );
78 _Scalar Max = roots.array().abs().maxCoeff();
79 _Scalar min = roots.array().abs().minCoeff();
80 bool eval = (M >= Max) && (m <= min);
81 if( !eval )
82 {
83 cerr << "Roots: " << roots << endl;
84 cerr << "Bounds: (" << m << ", " << M << ")" << endl;
85 cerr << "Min,Max: (" << min << ", " << Max << ")" << endl;
86 }
87 VERIFY( eval );
88}
89
90template<typename _Scalar> void CauchyBounds_scalar()
91{

Callers

nothing calls this directly

Calls 7

roots_to_monicPolynomialFunction · 0.85
cauchy_max_boundFunction · 0.85
cauchy_min_boundFunction · 0.85
absMethod · 0.80
maxCoeffMethod · 0.45
arrayMethod · 0.45
minCoeffMethod · 0.45

Tested by

no test coverage detected