ROOT 6.12/07 Reference Guide |
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 (unsigned int ndata=0, Interpolation::Type type=Interpolation::kCSPLINE) | |
Constructs an interpolator class from number of data points and with Interpolation::Type type. More... | |
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. More... | |
virtual | ~Interpolator () |
double | Deriv (double x) const |
Return the derivative of the interpolated function at point x. More... | |
double | Deriv2 (double x) const |
Return the second derivative of the interpolated function at point x. More... | |
double | Eval (double x) const |
Return the interpolated value at point x. More... | |
double | Integ (double a, double b) const |
Return the Integral of the interpolated function over the range [a,b]. More... | |
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. More... | |
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. More... | |
std::string | Type () const |
Return the type of interpolation method. More... | |
std::string | TypeGet () const |
Private Member Functions | |
Interpolator (const Interpolator &) | |
Interpolator & | operator= (const Interpolator &) |
Private Attributes | |
GSLInterpolator * | fInterp |
#include <Math/Interpolator.h>
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 39 of file Interpolator.cxx.
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 44 of file Interpolator.cxx.
|
virtual |
Definition at line 57 of file Interpolator.cxx.
|
private |
Definition at line 63 of file Interpolator.cxx.
double ROOT::Math::Interpolator::Deriv | ( | double | x | ) | const |
Return the derivative of the interpolated function at point x.
Definition at line 92 of file Interpolator.cxx.
double ROOT::Math::Interpolator::Deriv2 | ( | double | x | ) | const |
Return the second derivative of the interpolated function at point x.
Definition at line 98 of file Interpolator.cxx.
double ROOT::Math::Interpolator::Eval | ( | double | x | ) | const |
Return the interpolated value at point x.
Definition at line 86 of file Interpolator.cxx.
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 103 of file Interpolator.cxx.
|
private |
Definition at line 67 of file Interpolator.cxx.
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 79 of file Interpolator.cxx.
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 75 of file Interpolator.cxx.
std::string ROOT::Math::Interpolator::Type | ( | ) | const |
Return the type of interpolation method.
Definition at line 112 of file Interpolator.cxx.
std::string ROOT::Math::Interpolator::TypeGet | ( | ) | const |
Definition at line 108 of file Interpolator.cxx.
|
private |
Definition at line 139 of file Interpolator.h.