17 CSplineApprox::CSplineApprox(
const std::map<double, double> &pts) {
18 m_accel = gsl_interp_accel_alloc();
19 m_spline = gsl_spline_alloc(gsl_interp_cspline, pts.size());
21 std::vector<double> x, y;
22 for(
auto it = pts.begin(); it != pts.end(); it++) {
23 x.push_back(it->first);
24 y.push_back(it->second);
26 gsl_spline_init(m_spline, &x[0], &y[0], x.size());
29 CSplineApprox::~CSplineApprox() {
30 gsl_spline_free(m_spline);
31 gsl_interp_accel_free(m_accel);
35 return gsl_spline_eval(m_spline, x, m_accel);