Functions
test_interpolate.cxx File Reference
#include "WireCellUtil/Interpolate.h"
#include <boost/math/interpolators/cubic_b_spline.hpp>
#include <iostream>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 10 of file test_interpolate.cxx.

11 {
12  std::vector<double> f{0.01, -0.02, 0.3, 0.8, 1.9, -8.78, -22.6};
13  const double xstep = 0.01;
14  const double x0 = xstep;
15  boost::math::cubic_b_spline<double> spline(f.begin(), f.end(), x0, xstep);
16 
17  linterp<double> lin(f.begin(), f.end(), x0, xstep);
18 
19  for (double x = 0; x < x0 + xstep*10; x += 0.1*xstep) {
20  std::cout << std::setprecision(3)
21  << std::fixed << "x=" << x
22  << "\tlin(x)=" << lin(x)
23  << "\tspline(x)=" << spline(x)
24  << "\n";
25  }
26  return 0;
27 }
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
list x
Definition: train.py:276