<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.5"/> <title>Eigen-unsupported: Polynomials module</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="eigendoxy.css" rel="stylesheet" type="text/css"> <!-- --> <script type="text/javascript" src="eigen_navtree_hacks.js"></script> <!-- <script type="text/javascript"> --> <!-- </script> --> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <!-- <a name="top"></a> --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td> <td style="padding-left: 0.5em;"> <div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen-unsupported</a>  <span id="projectnumber">3.2.0</span> </div> </td> <td> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('group__Polynomials__Module.html','');}); </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Pages</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">Polynomials module</div> </div> </div><!--header--> <div class="contents"> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <p>This module provides a QR based polynomial solver. </p> <p>To use this module, add </p> <div class="fragment"><div class="line">* #include <unsupported/Eigen/Polynomials></div> <div class="line">* </div> </div><!-- fragment --><p> at the start of your source file. </p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Classes</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1PolynomialSolver.html">PolynomialSolver< _Scalar, _Deg ></a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">A polynomial solver. <a href="classEigen_1_1PolynomialSolver.html#details">More...</a><br/></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1PolynomialSolverBase.html">PolynomialSolverBase< _Scalar, _Deg ></a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Defined to be inherited by polynomial solvers: it provides convenient methods such as. <a href="classEigen_1_1PolynomialSolverBase.html#details">More...</a><br/></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:ga375e3ea1f370fb76dfe0f43a89b95926"><td class="memTemplParams" colspan="2">template<typename Polynomial > </td></tr> <tr class="memitem:ga375e3ea1f370fb76dfe0f43a89b95926"><td class="memTemplItemLeft" align="right" valign="top">NumTraits< typename <br class="typebreak"/> Polynomial::Scalar >::Real </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__Polynomials__Module.html#ga375e3ea1f370fb76dfe0f43a89b95926">cauchy_max_bound</a> (const Polynomial &poly)</td></tr> <tr class="separator:ga375e3ea1f370fb76dfe0f43a89b95926"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gab076afbdba0e9298a541cc4e8cc7506b"><td class="memTemplParams" colspan="2">template<typename Polynomial > </td></tr> <tr class="memitem:gab076afbdba0e9298a541cc4e8cc7506b"><td class="memTemplItemLeft" align="right" valign="top">NumTraits< typename <br class="typebreak"/> Polynomial::Scalar >::Real </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__Polynomials__Module.html#gab076afbdba0e9298a541cc4e8cc7506b">cauchy_min_bound</a> (const Polynomial &poly)</td></tr> <tr class="separator:gab076afbdba0e9298a541cc4e8cc7506b"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gadb64ffddaa9e83634e3ab0e3fd3664f5"><td class="memTemplParams" colspan="2">template<typename Polynomials , typename T > </td></tr> <tr class="memitem:gadb64ffddaa9e83634e3ab0e3fd3664f5"><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__Polynomials__Module.html#gadb64ffddaa9e83634e3ab0e3fd3664f5">poly_eval</a> (const Polynomials &poly, const T &x)</td></tr> <tr class="separator:gadb64ffddaa9e83634e3ab0e3fd3664f5"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gaadbf059bc28ce1cf94c57c1454633d40"><td class="memTemplParams" colspan="2">template<typename Polynomials , typename T > </td></tr> <tr class="memitem:gaadbf059bc28ce1cf94c57c1454633d40"><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__Polynomials__Module.html#gaadbf059bc28ce1cf94c57c1454633d40">poly_eval_horner</a> (const Polynomials &poly, const T &x)</td></tr> <tr class="separator:gaadbf059bc28ce1cf94c57c1454633d40"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gafbc3648f7ef67db3d5d04454fc1257fd"><td class="memTemplParams" colspan="2">template<typename RootVector , typename Polynomial > </td></tr> <tr class="memitem:gafbc3648f7ef67db3d5d04454fc1257fd"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__Polynomials__Module.html#gafbc3648f7ef67db3d5d04454fc1257fd">roots_to_monicPolynomial</a> (const RootVector &rv, Polynomial &poly)</td></tr> <tr class="separator:gafbc3648f7ef67db3d5d04454fc1257fd"><td class="memSeparator" colspan="2"> </td></tr> </table> <h3><a class="anchor" id="polynomials"></a>Polynomials defines functions for dealing with polynomials</h3><div class="textblock"><pre class="fragment"> and a QR based polynomial solver. The remainder of the page documents first the functions for evaluating, computing polynomials, computing estimates about polynomials and next the QR based polynomial solver. </pre><h1><a class="anchor" id="polynomialUtils"></a> convenient functions to deal with polynomials</h1> <h2><a class="anchor" id="roots_to_monicPolynomial"></a> roots_to_monicPolynomial</h2> <p>The function </p> <div class="fragment"><div class="line"><span class="keywordtype">void</span> <a class="code" href="group__Polynomials__Module.html#gafbc3648f7ef67db3d5d04454fc1257fd">roots_to_monicPolynomial</a>( <span class="keyword">const</span> RootVector& rv, Polynomial& poly )</div> </div><!-- fragment --><p> computes the coefficients <img class="formulaInl" alt="$ a_i $" src="form_37.png"/> of</p> <p><img class="formulaInl" alt="$ p(x) = a_0 + a_{1}x + ... + a_{n-1}x^{n-1} + x^n $" src="form_38.png"/> </p> <pre class="fragment"> where \form#39 is known through its roots i.e. \form#40. </pre><h2><a class="anchor" id="poly_eval"></a> poly_eval</h2> <p>The function </p> <div class="fragment"><div class="line">T <a class="code" href="group__Polynomials__Module.html#gadb64ffddaa9e83634e3ab0e3fd3664f5">poly_eval</a>( <span class="keyword">const</span> Polynomials& poly, <span class="keyword">const</span> T& x )</div> </div><!-- fragment --><p> evaluates a polynomial at a given point using stabilized Hörner method.</p> <p>The following code: first computes the coefficients in the monomial basis of the monic polynomial that has the provided roots; then, it evaluates the computed polynomial, using a stabilized Hörner method.</p> <div class="fragment"><div class="line"><span class="preprocessor">#include <unsupported/Eigen/Polynomials></span></div> <div class="line"><span class="preprocessor">#include <iostream></span></div> <div class="line"></div> <div class="line"><span class="keyword">using namespace </span>Eigen;</div> <div class="line"><span class="keyword">using namespace </span>std;</div> <div class="line"></div> <div class="line"><span class="keywordtype">int</span> main()</div> <div class="line">{</div> <div class="line"> Vector4d roots = Vector4d::Random();</div> <div class="line"> cout << <span class="stringliteral">"Roots: "</span> << roots.transpose() << endl;</div> <div class="line"> Eigen::Matrix<double,5,1> polynomial;</div> <div class="line"> <a class="code" href="group__Polynomials__Module.html#gafbc3648f7ef67db3d5d04454fc1257fd">roots_to_monicPolynomial</a>( roots, polynomial );</div> <div class="line"> cout << <span class="stringliteral">"Polynomial: "</span>;</div> <div class="line"> <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i<4; ++i ){ cout << polynomial[i] << <span class="stringliteral">".x^"</span> << i << <span class="stringliteral">"+ "</span>; }</div> <div class="line"> cout << polynomial[4] << <span class="stringliteral">".x^4"</span> << endl;</div> <div class="line"> Vector4d evaluation;</div> <div class="line"> <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i<4; ++i ){</div> <div class="line"> evaluation[i] = <a class="code" href="group__Polynomials__Module.html#gadb64ffddaa9e83634e3ab0e3fd3664f5">poly_eval</a>( polynomial, roots[i] ); }</div> <div class="line"> cout << <span class="stringliteral">"Evaluation of the polynomial at the roots: "</span> << evaluation.transpose();</div> <div class="line">}</div> </div><!-- fragment --><p> Output: </p> <pre class="fragment">Roots: 0.680375 -0.211234 0.566198 0.59688 Polynomial: -0.04857.x^0+ 0.00860842.x^1+ 0.739882.x^2+ -1.63222.x^3+ 1.x^4 Evaluation of the polynomial at the roots: -2.08167e-17 0 0 2.08167e-17</pre><h2><a class="anchor" id="Cauchy"></a> bounds</h2> <p>The function </p> <div class="fragment"><div class="line">Real <a class="code" href="group__Polynomials__Module.html#ga375e3ea1f370fb76dfe0f43a89b95926">cauchy_max_bound</a>( <span class="keyword">const</span> Polynomial& poly )</div> </div><!-- fragment --><p> provides a maximum bound (the Cauchy one: <img class="formulaInl" alt="$C(p)$" src="form_41.png"/>) for the absolute value of a root of the given polynomial i.e. <img class="formulaInl" alt="$ \forall r_i $" src="form_42.png"/> root of <img class="formulaInl" alt="$ p(x) = \sum_{k=0}^d a_k x^k $" src="form_43.png"/>, <img class="formulaInl" alt="$ |r_i| \le C(p) = \sum_{k=0}^{d} \left | \frac{a_k}{a_d} \right | $" src="form_44.png"/> The leading coefficient <img class="formulaInl" alt="$ p $" src="form_39.png"/>: should be non zero <img class="formulaInl" alt="$a_d \neq 0$" src="form_45.png"/>.</p> <pre class="fragment"> The function </pre> <div class="fragment"><div class="line">Real <a class="code" href="group__Polynomials__Module.html#gab076afbdba0e9298a541cc4e8cc7506b">cauchy_min_bound</a>( <span class="keyword">const</span> Polynomial& poly )</div> </div><!-- fragment --><p> provides a minimum bound (the Cauchy one: <img class="formulaInl" alt="$c(p)$" src="form_46.png"/>) for the absolute value of a non zero root of the given polynomial i.e. <img class="formulaInl" alt="$ \forall r_i \neq 0 $" src="form_47.png"/> root of <img class="formulaInl" alt="$ p(x) = \sum_{k=0}^d a_k x^k $" src="form_43.png"/>, <img class="formulaInl" alt="$ |r_i| \ge c(p) = \left( \sum_{k=0}^{d} \left | \frac{a_k}{a_0} \right | \right)^{-1} $" src="form_48.png"/></p> <h1><a class="anchor" id="QR"></a> polynomial solver class</h1> <p>Computes the complex roots of a polynomial by computing the eigenvalues of the associated companion matrix with the QR algorithm.</p> <p>The roots of <img class="formulaInl" alt="$ p(x) = a_0 + a_1 x + a_2 x^2 + a_{3} x^3 + x^4 $" src="form_49.png"/> are the eigenvalues of <img class="formulaInl" alt="$ \left [ \begin{array}{cccc} 0 & 0 & 0 & a_0 \\ 1 & 0 & 0 & a_1 \\ 0 & 1 & 0 & a_2 \\ 0 & 0 & 1 & a_3 \end{array} \right ] $" src="form_50.png"/> </p> <pre class="fragment"> However, the QR algorithm is not guaranteed to converge when there are several eigenvalues with same modulus. Therefore the current polynomial solver is guaranteed to provide a correct result only when the complex roots \form#51 have distinct moduli i.e. </pre><p><img class="formulaInl" alt="$ \forall i,j \in [1;d],~ \| r_i \| \neq \| r_j \| $" src="form_52.png"/>. </p> <pre class="fragment"> With 32bit (float) floating types this problem shows up frequently. </pre><p> However, almost always, correct accuracy is reached even in these cases for 64bit (double) floating types and small polynomial degree (<20). </p> <pre class="fragment"> \include PolynomialSolver1.cpp In the above example: -# a simple use of the polynomial solver is shown; -# the accuracy problem with the QR algorithm is presented: a polynomial with almost conjugate roots is provided to the solver. Those roots have almost same module therefore the QR algorithm failed to converge: the accuracy of the last root is bad; -# a simple way to circumvent the problem is shown: use doubles instead of floats. </pre><p>Output: </p> <pre class="fragment">Roots: 0.680375 -0.211234 0.566198 0.59688 0.823295 Complex roots: (-0.211234,0) (0.566198,0) (0.59688,0) (0.680375,0) (0.823295,0) Real roots: -0.211234 0.566198 0.59688 0.680375 0.823295 Illustration of the convergence problem with the QR algorithm: --------------------------------------------------------------- Hard case polynomial defined by floats: -0.957 0.9219 0.3516 0.9453 -0.4023 -0.5508 -0.03125 Complex roots: (1.19707,0) (0.70514,0) (-1.9834,0) (-0.396563,0.966801) (-0.396563,-0.966801) (-16.7513,0) Norms of the evaluations of the polynomial at the roots: 3.72694e-07 1.43051e-06 1.76896e-05 1.74676e-06 1.74676e-06 0.0823092 Using double's almost always solves the problem for small degrees: ------------------------------------------------------------------- Complex roots: (1.19707,0) (0.70514,0) (-1.9834,0) (-0.396564,0.966801) (-0.396564,-0.966801) (-16.7513,0) Norms of the evaluations of the polynomial at the roots: 3.78175e-07 0 2.0411e-06 2.48518e-07 2.48518e-07 0 The last root in float then in double: (-16.75127983,0) (-16.75128099,0) Norm of the difference: 1.907348633e-06 </pre> </div><h2 class="groupheader">Function Documentation</h2> <a class="anchor" id="ga375e3ea1f370fb76dfe0f43a89b95926"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">NumTraits<typename Polynomial::Scalar>::Real Eigen::cauchy_max_bound </td> <td>(</td> <td class="paramtype">const Polynomial & </td> <td class="paramname"><em>poly</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <dl class="section return"><dt>Returns</dt><dd>a maximum bound for the absolute value of any root of the polynomial.</dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">poly</td><td>: the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. <img class="formulaInl" alt="$ 1 + 3x^2 $" src="form_75.png"/> is stored as a vector <img class="formulaInl" alt="$ [ 1, 0, 3 ] $" src="form_76.png"/>.</td></tr> </table> </dd> </dl> <p><em><b>Precondition:</b></em> the leading coefficient of the input polynomial poly must be non zero </p> </div> </div> <a class="anchor" id="gab076afbdba0e9298a541cc4e8cc7506b"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">NumTraits<typename Polynomial::Scalar>::Real Eigen::cauchy_min_bound </td> <td>(</td> <td class="paramtype">const Polynomial & </td> <td class="paramname"><em>poly</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <dl class="section return"><dt>Returns</dt><dd>a minimum bound for the absolute value of any non zero root of the polynomial. </dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">poly</td><td>: the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. <img class="formulaInl" alt="$ 1 + 3x^2 $" src="form_75.png"/> is stored as a vector <img class="formulaInl" alt="$ [ 1, 0, 3 ] $" src="form_76.png"/>. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="gadb64ffddaa9e83634e3ab0e3fd3664f5"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">T Eigen::poly_eval </td> <td>(</td> <td class="paramtype">const Polynomials & </td> <td class="paramname"><em>poly</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const T & </td> <td class="paramname"><em>x</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <dl class="section return"><dt>Returns</dt><dd>the evaluation of the polynomial at x using stabilized Horner algorithm.</dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">poly</td><td>: the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. <img class="formulaInl" alt="$ 1 + 3x^2 $" src="form_75.png"/> is stored as a vector <img class="formulaInl" alt="$ [ 1, 0, 3 ] $" src="form_76.png"/>. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>: the value to evaluate the polynomial at. </td></tr> </table> </dd> </dl> <p>References <a class="el" href="group__Polynomials__Module.html#gaadbf059bc28ce1cf94c57c1454633d40">Eigen::poly_eval_horner()</a>.</p> </div> </div> <a class="anchor" id="gaadbf059bc28ce1cf94c57c1454633d40"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">T Eigen::poly_eval_horner </td> <td>(</td> <td class="paramtype">const Polynomials & </td> <td class="paramname"><em>poly</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const T & </td> <td class="paramname"><em>x</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <dl class="section return"><dt>Returns</dt><dd>the evaluation of the polynomial at x using Horner algorithm.</dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">poly</td><td>: the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. <img class="formulaInl" alt="$ 1 + 3x^2 $" src="form_75.png"/> is stored as a vector <img class="formulaInl" alt="$ [ 1, 0, 3 ] $" src="form_76.png"/>. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>: the value to evaluate the polynomial at.</td></tr> </table> </dd> </dl> <p><em><b>Note for stability:</b></em> <img class="formulaInl" alt="$ |x| \le 1 $" src="form_77.png"/> </p> <p>Referenced by <a class="el" href="group__Polynomials__Module.html#gadb64ffddaa9e83634e3ab0e3fd3664f5">Eigen::poly_eval()</a>.</p> </div> </div> <a class="anchor" id="gafbc3648f7ef67db3d5d04454fc1257fd"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Eigen::roots_to_monicPolynomial </td> <td>(</td> <td class="paramtype">const RootVector & </td> <td class="paramname"><em>rv</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Polynomial & </td> <td class="paramname"><em>poly</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Given the roots of a polynomial compute the coefficients in the monomial basis of the monic polynomial with same roots and minimal degree. If RootVector is a vector of complexes, Polynomial should also be a vector of complexes. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">rv</td><td>: a vector containing the roots of a polynomial. </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">poly</td><td>: the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. <img class="formulaInl" alt="$ 3 + x^2 $" src="form_78.png"/> is stored as a vector <img class="formulaInl" alt="$ [ 3, 0, 1 ] $" src="form_79.png"/>. </td></tr> </table> </dd> </dl> </div> </div> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Generated on Mon Oct 28 2013 11:05:27 for Eigen-unsupported by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li> </ul> </div> <!-- Piwik --> <!-- <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.sylphide-consulting.com/piwik/" : "http://stats.sylphide-consulting.com/piwik/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 20); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script><noscript><p><img src="http://stats.sylphide-consulting.com/piwik/piwik.php?idsite=20" style="border:0" alt="" /></p></noscript> --> <!-- End Piwik Tracking Code --> </body> </html>