18#ifndef OPAL_CUBIC_SPLINE_HH
19#define OPAL_CUBIC_SPLINE_HH
36 CubicSpline(
const std::vector<double>& x,
const std::vector<double>& y);
41 void init(
const std::vector<double>& x,
const std::vector<double>& y)
override;
67 [[nodiscard]]
double integral(
size_t i,
double dx)
const;
79 std::vector<double>
b_;
80 std::vector<double>
c_;
81 std::vector<double>
d_;
Accelerator caching last interval indices.
Base class for the linear and cubic interpolation spline classes.
Natural cubic spline interpolator.
void computeIntegrals()
Compute the integrals of the intervals.
double evalIntegral(double xa, double xb, Accelerator &accel) const override
Evaluate the integral of the spline at x.
void init(const std::vector< double > &x, const std::vector< double > &y) override
Initialize from tabulated data (natural spline).
void computeCoefficients()
Compute natural spline coefficients.
double extrapolateLeft(double x) const
Linear extrapolation to the left of the data range.
double extrapolateRight(double x) const
Linear extrapolation to the right of the data range.
CubicSpline()=default
Default constructor.
double eval(double x, Accelerator &accel) const override
Evaluate the spline at x using an accelerator.
double integral(size_t i, double dx) const
Calculate the integral from x_[i] to x_[i]+dx.
std::vector< double > integrals_