DiFfRG
Loading...
Searching...
No Matches
interpolation.hh
Go to the documentation of this file.
1#pragma once
2
3// standard library
4#include <memory>
5#include <vector>
6
7// external libraries
8#include <boost/math/interpolators/barycentric_rational.hpp>
9#include <gsl/gsl_spline.h>
10
11namespace DiFfRG
12{
13 namespace Interpolation
14 {
24 {
25 public:
34 Barycentric(std::vector<double> &x, std::vector<double> &y, uint order = 1, bool copy = true);
35
43 Barycentric(const std::vector<double> &x, const std::vector<double> &y, uint order = 1);
44
49
57 bool check_consistency(double tolerance) const;
58
65 double operator()(double x) const;
66
73 double value(double x) const;
74
81 double derivative(double x) const;
82
83 private:
84 std::unique_ptr<boost::math::interpolators::barycentric_rational<double>> interpolator;
85 };
86
92 {
93 public:
94 CubicSpline(const std::vector<double> &x, const std::vector<double> &y);
95
97
98 double operator()(double x) const;
99
100 double value(double x) const;
101
102 double derivative(double x) const;
103
104 private:
105 gsl_interp_accel *acc;
106 gsl_spline *spline;
107 };
108 } // namespace Interpolation
109} // namespace DiFfRG
This class takes in x-dependent data and interpolates it to a given x on request.
Definition interpolation.hh:24
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:84
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:92
gsl_spline * spline
Definition interpolation.hh:106
double derivative(double x) const
double value(double x) const
double operator()(double x) const
gsl_interp_accel * acc
Definition interpolation.hh:105
CubicSpline(const std::vector< double > &x, const std::vector< double > &y)
Definition complex_math.hh:14
unsigned int uint
Definition utils.hh:22