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. More... | |
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... | |
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 40 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 45 of file Interpolator.cxx.
|
virtual |
Definition at line 58 of file Interpolator.cxx.
|
private |
Definition at line 64 of file Interpolator.cxx.
Return the derivative of the interpolated function at point x.
Definition at line 93 of file Interpolator.cxx.
Return the second derivative of the interpolated function at point x.
Definition at line 99 of file Interpolator.cxx.
Return the interpolated value at point x.
Definition at line 87 of file Interpolator.cxx.
Return the Integral of the interpolated function over the range [a,b].
Definition at line 104 of file Interpolator.cxx.
|
private |
Definition at line 68 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 80 of file Interpolator.cxx.
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.
std::string ROOT::Math::Interpolator::Type | ( | ) | const |
Return the type of interpolation method.
Definition at line 113 of file Interpolator.cxx.
std::string ROOT::Math::Interpolator::TypeGet | ( | ) | const |
Definition at line 109 of file Interpolator.cxx.
|
private |
Definition at line 139 of file Interpolator.h.