Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
util
test
test_interpolate.cxx
Go to the documentation of this file.
1
#include "
WireCellUtil/Interpolate.h
"
2
#include <boost/math/interpolators/cubic_b_spline.hpp>
3
4
#include <iostream>
5
6
// https://www.boost.org/doc/libs/1_65_0/libs/math/doc/html/math_toolkit/interpolate/cubic_b.html
7
8
using namespace
WireCell
;
9
10
int
main
()
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
}
keras_to_tensorflow.f
f
Definition:
keras_to_tensorflow.py:162
setprecision
Q_EXPORT QTSManip setprecision(int p)
Definition:
qtextstream.h:343
WireCell
Definition:
Main.h:22
WireCell::linterp< double >
train.x
list x
Definition:
train.py:276
main
int main()
Definition:
test_interpolate.cxx:10
Interpolate.h
generate_CCQE_events.spline
string spline
Definition:
generate_CCQE_events.py:27
Generated by
1.8.11