15 const std::vector<double>& y) {
16 const auto N = x.size();
18 throw std::runtime_error(
19 "Need two vectors of equal length for interpolation.");
22 throw std::runtime_error(
23 "Need at least 3 data points for cubic spline interpolation.");
26 x, [&](
double const& a,
double const& b) {
return a < b; });
35 acc_ = gsl_interp_accel_alloc();
36 spline_ = gsl_spline_alloc(gsl_interp_cspline, N);
37 gsl_spline_init(
spline_, &(*sorted_x.begin()), &(*sorted_y.begin()), N);
42 gsl_interp_accel_free(
acc_);