ampsci
High-precision calculations for one- and two-valence atomic systems
Interpolator::Interp

ok

Stateful 1D interpolation object using GSL.

Constructed from data vectors x and y (interpreted as samples of y(x)). Once constructed, evaluates the interpolated function at arbitrary points via interp() or operator().

Does not extrapolate: returns 0.0 for x outside [x.front(), x.back()].

Copy construction and copy assignment are deleted.

Note
x and y are copied into GSL internal storage during construction; the input vectors do not need to outlive the Interp object.

#include <Interpolator.hpp>

Public Member Functions

 Interp (const std::vector< double > &x, const std::vector< double > &y, Method method=Method::cspline)
 Construct interpolation object from data points.
 
 Interp (const Interpolator::Interp &)=delete
 Copy construction deleted.
 
Interpoperator= (const Interpolator::Interp &)=delete
 Copy assignment deleted.
 
double interp (double x) const
 Returns interpolated y(x). Returns 0.0 if x is outside [x0, xmax].
 
std::vector< double > interp (const std::vector< double > &x) const
 Returns interpolated y(x) for each point in x. Returns 0.0 outside range.
 
double operator() (double x) const
 Returns interpolated y(x). Returns 0.0 if x is outside [x0, xmax].
 
std::vector< double > operator() (const std::vector< double > &x) const
 Returns interpolated y(x) for each point in x. Returns 0.0 outside range.
 

Constructor & Destructor Documentation

◆ Interp() [1/2]

Interpolator::Interp::Interp ( const std::vector< double > &  x,
const std::vector< double > &  y,
Method  method = Method::cspline 
)
inline

Construct interpolation object from data points.

Parameters
xStrictly increasing x values (abscissae).
yFunction values y(x); must satisfy y.size() == x.size().
methodInterpolation method (default: cspline).

◆ Interp() [2/2]

Interpolator::Interp::Interp ( const Interpolator::Interp )
delete

Copy construction deleted.

Member Function Documentation

◆ operator=()

Interp & Interpolator::Interp::operator= ( const Interpolator::Interp )
delete

Copy assignment deleted.

◆ interp() [1/2]

double Interpolator::Interp::interp ( double  x) const
inline

Returns interpolated y(x). Returns 0.0 if x is outside [x0, xmax].

◆ interp() [2/2]

std::vector< double > Interpolator::Interp::interp ( const std::vector< double > &  x) const
inline

Returns interpolated y(x) for each point in x. Returns 0.0 outside range.

◆ operator()() [1/2]

double Interpolator::Interp::operator() ( double  x) const
inline

Returns interpolated y(x). Returns 0.0 if x is outside [x0, xmax].

◆ operator()() [2/2]

std::vector< double > Interpolator::Interp::operator() ( const std::vector< double > &  x) const
inline

Returns interpolated y(x) for each point in x. Returns 0.0 outside range.


The documentation for this class was generated from the following file: