SpECTRE  2021.08.02
intrp::CubicSpline Class Reference

A natural cubic spline interpolation class. More...

#include <CubicSpline.hpp>

Public Member Functions

 CubicSpline (std::vector< double > x_values, std::vector< double > y_values) noexcept
 
 CubicSpline (const CubicSpline &)=delete
 
CubicSplineoperator= (const CubicSpline &)=delete
 
 CubicSpline (CubicSpline &&) noexcept=default
 
CubicSplineoperator= (CubicSpline &&rhs) noexcept=default
 
double operator() (double x_to_interp_to) const noexcept
 
void pup (PUP::er &p) noexcept
 

Detailed Description

A natural cubic spline interpolation class.

The class builds a cubic spline interpolant with natural boundary conditions using the x_values and y_values passed into the constructor. For details on the algorithm see the GSL documentation on gsl_interp_cspline.

Here is an example how to use this class:

intrp::CubicSpline interpolant{x_values, y_values};
const double x_to_interpolate_to =
CHECK(interpolant(x_to_interpolate_to) ==
custom_approx_interior(function(x_to_interpolate_to)));
A natural cubic spline interpolation class.
Definition: CubicSpline.hpp:29
T lower_bound(T... args)
T upper_bound(T... args)