/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/interpolation.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/interpolation.hh Source File
DiFfRG
interpolation.hh
Go to the documentation of this file.
1#pragma once
2
3// standard library
4#include <vector>
5
6// external libraries
7#include <boost/math/interpolators/barycentric_rational.hpp>
8#include <gsl/gsl_spline.h>
9
10namespace DiFfRG
11{
12 namespace Interpolation
13 {
23 {
24 public:
33 Barycentric(std::vector<double> &x, std::vector<double> &y, uint order = 1, bool copy = true);
34
42 Barycentric(const std::vector<double> &x, const std::vector<double> &y, uint order = 1);
43
48
56 bool check_consistency(double tolerance) const;
57
64 double operator()(double x) const;
65
72 double value(double x) const;
73
80 double derivative(double x) const;
81
82 private:
83 std::unique_ptr<boost::math::interpolators::barycentric_rational<double>> interpolator;
84 };
85
91 {
92 public:
93 CubicSpline(const std::vector<double> &x, const std::vector<double> &y);
94
96
97 double operator()(double x) const;
98
99 double value(double x) const;
100
101 double derivative(double x) const;
102
103 private:
104 gsl_interp_accel *acc;
105 gsl_spline *spline;
106 };
107 } // namespace Interpolation
108} // namespace DiFfRG
This class takes in x-dependent data and interpolates it to a given x on request.
Definition interpolation.hh:23
Barycentric()
Construct an empty Interpolator object.
Barycentric(const std::vector< double > &x, const std::vector< double > &y, uint order=1)
Construct a new Interpolator object.
std::unique_ptr< boost::math::interpolators::barycentric_rational< double > > interpolator
Definition interpolation.hh:83
double derivative(double x) const
Interpolate the derivative of the data to a given x.
bool check_consistency(double tolerance) const
Check whether the interpolator is consistent with the original data. The interpolator checks if it ca...
double value(double x) const
Interpolate the data to a given x.
Barycentric(std::vector< double > &x, std::vector< double > &y, uint order=1, bool copy=true)
Construct a new Interpolator object.
double operator()(double x) const
Interpolate the data to a given x.
This class takes in x-dependent data and interpolates it to a given x on request. This class uses the...
Definition interpolation.hh:91
gsl_spline * spline
Definition interpolation.hh:105
double derivative(double x) const
double value(double x) const
double operator()(double x) const
gsl_interp_accel * acc
Definition interpolation.hh:104
CubicSpline(const std::vector< double > &x, const std::vector< double > &y)
Definition complex_math.hh:10
unsigned int uint
Definition utils.hh:24