35#include "gsl/gsl_math.h" 
   36#include "gsl/gsl_errno.h" 
   37#include "gsl/gsl_poly.h" 
   38#include "gsl/gsl_poly.h" 
   54  fDerived_params(
std::vector<double>(
n) )
 
   62  fDerived_params(
std::vector<double>(1) )
 
   72  fDerived_params(
std::vector<double>(2) )
 
   84  fDerived_params(
std::vector<double>(3) )
 
   97  fDerived_params(
std::vector<double>(4) )
 
  122    return gsl_poly_eval( p, 
fOrder + 1, 
x);
 
  130   for ( 
unsigned int i = 0; i < 
fOrder; ++i )
 
  139      return gsl_pow_int(
x, ipar);
 
  171      fRoots.push_back( std::complex<double> ( 
r, 0.0) );
 
  179         std::cout << 
"Polynomial quadratic ::-  FAILED to find roots" << std::endl;
 
  183      fRoots.push_back(std::complex<double>(z1.dat[0],z1.dat[1]) );
 
  184      fRoots.push_back(std::complex<double>(z2.dat[0],z2.dat[1]) );
 
  188      gsl_complex  z1, z2, z3;
 
  197         std::cout << 
"Polynomial  cubic::-  FAILED to find roots" << std::endl;
 
  202      fRoots.push_back(std::complex<double> (z1.dat[0],z1.dat[1]) );
 
  203      fRoots.push_back(std::complex<double> (z2.dat[0],z2.dat[1]) );
 
  204      fRoots.push_back(std::complex<double> (z3.dat[0],z3.dat[1]) );
 
  209      gsl_complex  z1, z2, z3, z4;
 
  219         std::cout << 
"Polynomial quartic ::-  FAILED to find roots" << std::endl;
 
  223      fRoots.push_back(std::complex<double> (z1.dat[0],z1.dat[1]) );
 
  224      fRoots.push_back(std::complex<double> (z2.dat[0],z2.dat[1]) );
 
  225      fRoots.push_back(std::complex<double> (z3.dat[0],z3.dat[1]) );
 
  226      fRoots.push_back(std::complex<double> (z4.dat[0],z4.dat[1]) );
 
  240  std::vector<double> 
roots;
 
  242  for (
unsigned int i = 0; i < 
fOrder; ++i) {
 
  243    if (
fRoots[i].imag() == 0)
 
  264    gsl_poly_complex_workspace * w = gsl_poly_complex_workspace_alloc( 
n + 1);
 
  265    std::vector<double> z(2*
n);
 
  266    int status = gsl_poly_complex_solve ( 
Parameters(), 
n+1, w, &z.front() );
 
  267    gsl_poly_complex_workspace_free(w);
 
  269    for (
unsigned int i = 0; i < 
n; ++i)
 
  270      fRoots.push_back(std::complex<double> (z[2*i],z[2*i+1] ) );
 
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
virtual const double * Parameters() const
Access the parameter values.
std::vector< double > fParams
Parametric Function class describing polynomials of order n.
IGenFunction * Clone() const
Clone a function.
double DoDerivative(double x) const
function to evaluate the derivative with respect each coordinate.
const std::vector< std::complex< double > > & FindRoots()
Find the polynomial roots.
std::vector< std::complex< double > > fRoots
Polynomial(unsigned int n=0)
Construct a Polynomial function of order n.
double DoParameterDerivative(double x, const double *p, unsigned int ipar) const
Evaluate the gradient, to be implemented by the derived classes.
double DoEvalPar(double x, const double *p) const
Implementation of the evaluation function using the x value and the parameters.
std::vector< double > FindRealRoots()
Find the only the real polynomial roots.
const std::vector< std::complex< double > > & FindNumRoots()
Find the polynomial roots using always an iterative numerical methods The numerical method used is fr...
std::vector< double > fDerived_params
int gsl_poly_complex_solve_quartic(double a, double b, double c, double d, gsl_complex *z0, gsl_complex *z1, gsl_complex *z2, gsl_complex *z3)
Namespace for new Math classes and functions.
Namespace for new ROOT classes and functions.
int gsl_poly_complex_solve_cubic(double a, double b, double c, gsl_complex *z0, gsl_complex *z1, gsl_complex *z2)