PolynomialUtils1.cpp
Go to the documentation of this file.
00001 #include <unsupported/Eigen/Polynomials>
00002 #include <iostream>
00003 
00004 using namespace Eigen;
00005 using namespace std;
00006 
00007 int main()
00008 {
00009   Vector4d roots = Vector4d::Random();
00010   cout << "Roots: " << roots.transpose() << endl;
00011   Eigen::Matrix<double,5,1> polynomial;
00012   roots_to_monicPolynomial( roots, polynomial );
00013   cout << "Polynomial: ";
00014   for( int i=0; i<4; ++i ){ cout << polynomial[i] << ".x^" << i << "+ "; }
00015   cout << polynomial[4] << ".x^4" << endl;
00016   Vector4d evaluation;
00017   for( int i=0; i<4; ++i ){
00018     evaluation[i] = poly_eval( polynomial, roots[i] ); }
00019   cout << "Evaluation of the polynomial at the roots: " << evaluation.transpose();
00020 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:32:09