PolynomialUtils1.cpp
Go to the documentation of this file.
1 #include <unsupported/Eigen/Polynomials>
2 #include <iostream>
3 
4 using namespace Eigen;
5 using namespace std;
6 
7 int main()
8 {
9  Vector4d roots = Vector4d::Random();
10  cout << "Roots: " << roots.transpose() << endl;
11  Eigen::Matrix<double,5,1> polynomial;
12  roots_to_monicPolynomial( roots, polynomial );
13  cout << "Polynomial: ";
14  for( int i=0; i<4; ++i ){ cout << polynomial[i] << ".x^" << i << "+ "; }
15  cout << polynomial[4] << ".x^4" << endl;
16  Vector4d evaluation;
17  for( int i=0; i<4; ++i ){
18  evaluation[i] = poly_eval( polynomial, roots[i] ); }
19  cout << "Evaluation of the polynomial at the roots: " << evaluation.transpose();
20 }
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::poly_eval
T poly_eval(const Polynomials &poly, const T &x)
Definition: PolynomialUtils.h:46
Eigen::roots_to_monicPolynomial
void roots_to_monicPolynomial(const RootVector &rv, Polynomial &poly)
Definition: PolynomialUtils.h:127
main
int main()
Definition: PolynomialUtils1.cpp:7
std
Definition: BFloat16.h:88
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:34:23