#include <interpolation.h>
Represent a cubic spline interpolation.
Definition at line 272 of file interpolation.h.
Public Member Functions | |
| InterpolateDataSpline (const std::vector< double > &x, const std::vector< double > &y, ExtrapolationType extrapolation_type=ExtrapolationType::None) | |
| Interpolate function f given discrete samples f(x_i) = y_i. More... | |
| ~InterpolateDataSpline () | |
| Destructor. More... | |
| double | operator() (double x) const |
| Calculate spline interpolation at x. More... | |
Private Attributes | |
| ExtrapolationType | extrapolation_type_ = ExtrapolationType::None |
| Extrapolation type. More... | |
| double | first_x_ = smash_NaN<double> |
| First x value of underlying data. More... | |
| double | last_x_ = smash_NaN<double> |
| Last x value of underlying data. More... | |
| double | first_y_ = smash_NaN<double> |
| First y value of underlying data. More... | |
| double | last_y_ = smash_NaN<double> |
| Last y value of underlying data. More... | |
| gsl_interp_accel * | acc_ = nullptr |
| GSL iterator for interpolation lookups. More... | |
| gsl_spline * | spline_ = nullptr |
| GSL spline. More... | |
| smash::InterpolateDataSpline::InterpolateDataSpline | ( | const std::vector< double > & | x, |
| const std::vector< double > & | y, | ||
| ExtrapolationType | extrapolation_type = ExtrapolationType::None |
||
| ) |
Interpolate function f given discrete samples f(x_i) = y_i.
Cubic spline interpolation is used.
| x | x-values. |
| y | y-values. |
| extrapolation_type | Type of extrapolation for requested x_i values that are out of bounds. Extrapolation is by default disabled. Possible types are None, Zero, and Constant. |
| std::invalid_argument | if vectors x and y have different length. |
| std::invalid_argument | if less than 3 data points are provided. |
| std::out_of_range | if values outside of the boundaries of the underlying data are tried to be accessed and extrapolation is disabled. |
| std::invalid_argument | if unsupported extrapolation type is requested. |
Definition at line 14 of file interpolation.cc.
| smash::InterpolateDataSpline::~InterpolateDataSpline | ( | ) |
Destructor.
Definition at line 52 of file interpolation.cc.
| double smash::InterpolateDataSpline::operator() | ( | double | x | ) | const |
Calculate spline interpolation at x.
| x | Interpolation argument. |
| std::out_of_range | if values outside of the boundaries of the underlying data are tried to be accessed and extrapolation is disabled. |
Definition at line 57 of file interpolation.cc.
|
private |
Extrapolation type.
Definition at line 316 of file interpolation.h.
|
private |
First x value of underlying data.
Definition at line 318 of file interpolation.h.
|
private |
Last x value of underlying data.
Definition at line 320 of file interpolation.h.
|
private |
First y value of underlying data.
Definition at line 322 of file interpolation.h.
|
private |
Last y value of underlying data.
Definition at line 324 of file interpolation.h.
|
private |
GSL iterator for interpolation lookups.
Definition at line 326 of file interpolation.h.
|
private |
GSL spline.
Definition at line 328 of file interpolation.h.