DiFfRG
Loading...
Searching...
No Matches
DiFfRG::Interpolation::Barycentric Class Reference

This class takes in x-dependent data and interpolates it to a given x on request. More...

#include <interpolation.hh>

Public Member Functions

 Barycentric (std::vector< double > &x, std::vector< double > &y, uint order=1, bool copy=true)
 Construct a new Interpolator object.
 
 Barycentric (const std::vector< double > &x, const std::vector< double > &y, uint order=1)
 Construct a new Interpolator object.
 
 Barycentric ()
 Construct an empty Interpolator object.
 
bool check_consistency (double tolerance) const
 Check whether the interpolator is consistent with the original data. The interpolator checks if it can reproduce the original data with a given relative precision.
 
double operator() (double x) const
 Interpolate the data to a given x.
 
double value (double x) const
 Interpolate the data to a given x.
 
double derivative (double x) const
 Interpolate the derivative of the data to a given x.
 

Private Attributes

std::unique_ptr< boost::math::interpolators::barycentric_rational< double > > interpolator
 

Detailed Description

This class takes in x-dependent data and interpolates it to a given x on request.

Note, that interpolations beyond the range of the data will return the value at the closest boundary.

Internally, the boost barycentric rational interpolator is used.

Constructor & Destructor Documentation

◆ Barycentric() [1/3]

DiFfRG::Interpolation::Barycentric::Barycentric ( std::vector< double > & x,
std::vector< double > & y,
uint order = 1,
bool copy = true )

Construct a new Interpolator object.

Parameters
xThe x values of the data.
yThe y values of the data.
orderThe order of the interpolator.
copyWhether to copy the data or move it into the interpolator, making the original data unusable.

◆ Barycentric() [2/3]

DiFfRG::Interpolation::Barycentric::Barycentric ( const std::vector< double > & x,
const std::vector< double > & y,
uint order = 1 )

Construct a new Interpolator object.

Parameters
xThe x values of the data.
yThe y values of the data.
orderThe order of the interpolator.

◆ Barycentric() [3/3]

DiFfRG::Interpolation::Barycentric::Barycentric ( )

Construct an empty Interpolator object.

Member Function Documentation

◆ check_consistency()

bool DiFfRG::Interpolation::Barycentric::check_consistency ( double tolerance) const

Check whether the interpolator is consistent with the original data. The interpolator checks if it can reproduce the original data with a given relative precision.

Parameters
toleranceThe relative precision to use.
Returns
true If the interpolator is consistent with the original data.

◆ derivative()

double DiFfRG::Interpolation::Barycentric::derivative ( double x) const

Interpolate the derivative of the data to a given x.

Parameters
xThe x to interpolate to.
Returns
double The interpolated derivative.

◆ operator()()

double DiFfRG::Interpolation::Barycentric::operator() ( double x) const

Interpolate the data to a given x.

Parameters
xThe x to interpolate to.
Returns
double The interpolated data.

◆ value()

double DiFfRG::Interpolation::Barycentric::value ( double x) const

Interpolate the data to a given x.

Parameters
xThe x to interpolate to.
Returns
double The interpolated data.

Member Data Documentation

◆ interpolator

std::unique_ptr<boost::math::interpolators::barycentric_rational<double> > DiFfRG::Interpolation::Barycentric::interpolator
private

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