Unit test of class CubicSpline.
More...
|
| | CubicSplineTest () |
| |
| | ~CubicSplineTest ()=default |
| |
| double | error_bound (int n, const double *x, const std::function< double(double)> &f, int d=0) const |
| | theoretical error bound for complete cubic spline
|
| |
| void | read (const std::string &fname, int &n, double *x, double *y, BoundaryCondition &bc_start, BoundaryCondition &bc_end, int &n_interp, double *x_interp, double *y_interp, double *dy_interp, double *d2y_interp) const |
| |
|
| int | n_max_ |
| | maximum number of knots
|
| |
| std::vector< double > | spline_ |
| | buffer for a cubic spline (x_, y_ & dy_)
|
| |
| double * | x_ |
| | knots (x-coordinates of data points)
|
| |
| double * | y_ |
| | values at knots (y-coordinates of data points)
|
| |
| double * | dy_ |
| | derivatives at knots (computed when building a cubic spline)
|
| |
| int | n_interp_max_ |
| | maximum number of places to evaluate an interpolant
|
| |
| std::vector< double > | interp_ |
| | buffer for interpolant evaluation
|
| |
| double * | x_interp_ |
| | places to evaluate an interpolant
|
| |
| double * | y_interp_ |
| | values and derivatives of the interpolant at x_interp_
|
| |
| double * | dy_interp_ |
| |
| double * | d2y_interp_ |
| |
| double * | y_ref_ |
| | reference values and derivatives
|
| |
| double * | dy_ref_ |
| |
| double * | d2y_ref_ |
| |
| const double | tol_ [3] = {1e-14, 1e-13, 1e-12} |
| | y/dy/d2y tolerance for cross-check
|
| |
| std::vector< std::vector< std::function< double(double)> > > | f_ |
| | Sample functions & derivatives in error bound check.
|
| |
Unit test of class CubicSpline.
Tested functions include:
- build Constructs a cubic spline interpolant from a set of data points and boundary conditions.
- eval Evaluates a single interpolant at multiple places.
- add Adds an interpolant that shares the same knots.
- multi_eval Evaluates multiple interpolants at a single place.
- reserve Reserves memory for multiple interpolants.
- heap_usage Returns the heap usage of the object.
- xmin, xmax Returns the first and last knots.
◆ CubicSplineTest()
| CubicSplineTest::CubicSplineTest |
( |
| ) |
|
|
protected |
◆ ~CubicSplineTest()
| CubicSplineTest::~CubicSplineTest |
( |
| ) |
|
|
protecteddefault |
◆ error_bound()
| double CubicSplineTest::error_bound |
( |
int |
n, |
|
|
const double * |
x, |
|
|
const std::function< double(double)> & |
f, |
|
|
int |
d = 0 |
|
) |
| const |
|
protected |
theoretical error bound for complete cubic spline
◆ read()
| void CubicSplineTest::read |
( |
const std::string & |
fname, |
|
|
int & |
n, |
|
|
double * |
x, |
|
|
double * |
y, |
|
|
BoundaryCondition & |
bc_start, |
|
|
BoundaryCondition & |
bc_end, |
|
|
int & |
n_interp, |
|
|
double * |
x_interp, |
|
|
double * |
y_interp, |
|
|
double * |
dy_interp, |
|
|
double * |
d2y_interp |
|
) |
| const |
|
protected |
◆ d2y_interp_
| double* CubicSplineTest::d2y_interp_ |
|
protected |
◆ d2y_ref_
| double* CubicSplineTest::d2y_ref_ |
|
protected |
◆ dy_
| double* CubicSplineTest::dy_ |
|
protected |
derivatives at knots (computed when building a cubic spline)
◆ dy_interp_
| double* CubicSplineTest::dy_interp_ |
|
protected |
◆ dy_ref_
| double* CubicSplineTest::dy_ref_ |
|
protected |
◆ f_
| std::vector<std::vector<std::function<double(double)> > > CubicSplineTest::f_ |
|
protected |
Sample functions & derivatives in error bound check.
- Note
- Functions with vanishing 4-th derivative in an interval should in principle be interpolated exactly by a cubic spline. However, the presence of floating-point rounding errors would lead to some discrepancy between the interpolant and the original function. Such error is not covered by the error bound formula. Functions here should not include those kind of functions.
◆ interp_
| std::vector<double> CubicSplineTest::interp_ |
|
protected |
buffer for interpolant evaluation
◆ n_interp_max_
| int CubicSplineTest::n_interp_max_ |
|
protected |
maximum number of places to evaluate an interpolant
◆ n_max_
| int CubicSplineTest::n_max_ |
|
protected |
◆ spline_
| std::vector<double> CubicSplineTest::spline_ |
|
protected |
buffer for a cubic spline (x_, y_ & dy_)
◆ tol_
| const double CubicSplineTest::tol_[3] = {1e-14, 1e-13, 1e-12} |
|
protected |
y/dy/d2y tolerance for cross-check
◆ x_
| double* CubicSplineTest::x_ |
|
protected |
knots (x-coordinates of data points)
◆ x_interp_
| double* CubicSplineTest::x_interp_ |
|
protected |
places to evaluate an interpolant
◆ y_
| double* CubicSplineTest::y_ |
|
protected |
values at knots (y-coordinates of data points)
◆ y_interp_
| double* CubicSplineTest::y_interp_ |
|
protected |
values and derivatives of the interpolant at x_interp_
◆ y_ref_
| double* CubicSplineTest::y_ref_ |
|
protected |
reference values and derivatives
The documentation for this class was generated from the following file: