Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::Interpolator Class Reference

Class for performing function interpolation of points.

The class is instantiated with an interpolation methods, passed as an enumeration in the constructor. See Interpolation::Type for the available interpolation algorithms, which are implemented using GSL. See also the <A HREF=http://www.gnu.org/software/gsl/manual/html_node/Interpolation.html">GSL manual for more information. The class provides additional methods for computing derivatives and integrals of interpolating functions.

This class does not support copying.

Definition at line 66 of file Interpolator.h.

Public Member Functions

 Interpolator (const std::vector< double > &x, const std::vector< double > &y, Interpolation::Type type=Interpolation::kCSPLINE)
 Constructs an interpolator class from vector of data points \( (x_i, y_i )\) and with Interpolation::Type type.
 
 Interpolator (unsigned int ndata=0, Interpolation::Type type=Interpolation::kCSPLINE)
 Constructs an interpolator class from number of data points and with Interpolation::Type type.
 
virtual ~Interpolator ()
 
double Deriv (double x) const
 Return the derivative of the interpolated function at point x.
 
double Deriv2 (double x) const
 Return the second derivative of the interpolated function at point x.
 
double Eval (double x) const
 Return the interpolated value at point x.
 
double Integ (double a, double b) const
 Return the Integral of the interpolated function over the range [a,b].
 
bool SetData (const std::vector< double > &x, const std::vector< double > &y)
 Set the data vector ( x[] and y[] ) To be efficient, the size of the data must be the same of the value used in the constructor (ndata) If this is not the case a new re-initialization is performed with the new data size.
 
bool SetData (unsigned int ndata, const double *x, const double *y)
 Set the data vector ( x[] and y[] ) To be efficient, the size of the data must be the same of the value used when constructing the class (ndata) If this is not the case a new re-initialization is performed with the new data size.
 
std::string Type () const
 Return the type of interpolation method.
 
std::string TypeGet () const
 

Private Member Functions

 Interpolator (const Interpolator &)
 
Interpolatoroperator= (const Interpolator &)
 

Private Attributes

GSLInterpolatorfInterp
 

#include <Math/Interpolator.h>

Constructor & Destructor Documentation

◆ Interpolator() [1/3]

ROOT::Math::Interpolator::Interpolator ( unsigned int  ndata = 0,
Interpolation::Type  type = Interpolation::kCSPLINE 
)

Constructs an interpolator class from number of data points and with Interpolation::Type type.

The data can be set later on with the SetData method. In case the data size is not known, better using the default of zero or the next constructor later on. The default interpolation type is Cubic spline

Definition at line 40 of file Interpolator.cxx.

◆ Interpolator() [2/3]

ROOT::Math::Interpolator::Interpolator ( const std::vector< double > &  x,
const std::vector< double > &  y,
Interpolation::Type  type = Interpolation::kCSPLINE 
)

Constructs an interpolator class from vector of data points \( (x_i, y_i )\) and with Interpolation::Type type.

The method will compute a continuous interpolating function \( y(x) \) such that \( y_i = y ( x_i )\). The default interpolation type is Cubic spline

Definition at line 45 of file Interpolator.cxx.

◆ ~Interpolator()

ROOT::Math::Interpolator::~Interpolator ( )
virtual

Definition at line 58 of file Interpolator.cxx.

◆ Interpolator() [3/3]

ROOT::Math::Interpolator::Interpolator ( const Interpolator )
private

Definition at line 64 of file Interpolator.cxx.

Member Function Documentation

◆ Deriv()

double ROOT::Math::Interpolator::Deriv ( double  x) const

Return the derivative of the interpolated function at point x.

Definition at line 93 of file Interpolator.cxx.

◆ Deriv2()

double ROOT::Math::Interpolator::Deriv2 ( double  x) const

Return the second derivative of the interpolated function at point x.

Definition at line 99 of file Interpolator.cxx.

◆ Eval()

double ROOT::Math::Interpolator::Eval ( double  x) const

Return the interpolated value at point x.

Definition at line 87 of file Interpolator.cxx.

◆ Integ()

double ROOT::Math::Interpolator::Integ ( double  a,
double  b 
) const

Return the Integral of the interpolated function over the range [a,b].

Definition at line 104 of file Interpolator.cxx.

◆ operator=()

Interpolator & ROOT::Math::Interpolator::operator= ( const Interpolator rhs)
private

Definition at line 68 of file Interpolator.cxx.

◆ SetData() [1/2]

bool ROOT::Math::Interpolator::SetData ( const std::vector< double > &  x,
const std::vector< double > &  y 
)

Set the data vector ( x[] and y[] ) To be efficient, the size of the data must be the same of the value used in the constructor (ndata) If this is not the case a new re-initialization is performed with the new data size.

Definition at line 80 of file Interpolator.cxx.

◆ SetData() [2/2]

bool ROOT::Math::Interpolator::SetData ( unsigned int  ndata,
const double x,
const double y 
)

Set the data vector ( x[] and y[] ) To be efficient, the size of the data must be the same of the value used when constructing the class (ndata) If this is not the case a new re-initialization is performed with the new data size.

Definition at line 76 of file Interpolator.cxx.

◆ Type()

std::string ROOT::Math::Interpolator::Type ( ) const

Return the type of interpolation method.

Definition at line 113 of file Interpolator.cxx.

◆ TypeGet()

std::string ROOT::Math::Interpolator::TypeGet ( ) const

Definition at line 109 of file Interpolator.cxx.

Member Data Documentation

◆ fInterp

GSLInterpolator* ROOT::Math::Interpolator::fInterp
private

Definition at line 139 of file Interpolator.h.

Libraries for ROOT::Math::Interpolator:

The documentation for this class was generated from the following files: