28 inline double f5(
const double x0,
34 return TMath::Gaus(x4, x0+x1+x2+x3, 1.0, kTRUE);
45 int main(
int argc,
char **argv)
57 JParser<> zap(
"Example program to create 1D function interpolator from multi-dimensional interpolator.");
66 catch(
const exception &error) {
67 FATAL(error.what() << endl);
70 ASSERT(numberOfEvents > 0);
72 const double xmin = -1.0;
73 const double xmax = +1.0;
74 const double dx = (xmax - xmin) / (numberOfBins - 1);
77 typedef JFunction1D_t::abscissa_type abscissa_type;
78 typedef JFunction1D_t::value_type value_type;
90 for (
double x0 = xmin; x0 < xmax + 0.5*dx; x0 += dx) {
91 for (
double x1 = xmin; x1 < xmax + 0.5*dx; x1 += dx) {
92 for (
double x2 = xmin; x2 < xmax + 0.5*dx; x2 += dx) {
93 for (
double x3 = xmin; x3 < xmax + 0.5*dx; x3 += dx) {
94 for (
double x4 = xmin; x4 < xmax + 0.5*dx; x4 += dx) {
95 g5[x0][x1][x2][x3][x4] =
f5(x0,x1,x2,x3,x4);
96 h5[x0][x1][x2][x3][x4] =
f5(x0,x1,x2,x3,x4);
106 const double x0 = +0.15;
107 const double x1 = -0.25;
108 const double x2 = 0.25;
109 const double x3 = -0.15;
113 JTimer timer(
"4D interpolator");
117 for (
int i = 0; i != 100; ++i) {
118 copy(h5(x0,x1,x2,x3),
g1);
126 JTimer t1(
"1D interpolator");
127 JTimer t5(
"5D interpolator");
141 for (
int i = 0; i != numberOfEvents; ++i) {
143 for (
int __i = 0; __i != N; ++__i) {
145 const double x4 = gRandom->Uniform(xmin, xmax);
148 y[__i] =
f5(x0,x1,x2,x3,x4);
153 for (
int __i = 0; __i != N; ++__i) {
161 for (
int __i = 0; __i != N; ++__i) {
162 w[__i] = g5(x0,x1,x2,x3,x[__i]);
167 for (
int __i = 0; __i != N; ++__i) {
168 Q1.
put(v[__i] - y[__i]);
169 Q5.
put(w[__i] - y[__i]);
176 Q5.
print(cout,
false);
178 t1.
print(cout, 1.0 / (N * numberOfEvents),
nano_t);
179 t5.
print(cout, 1.0 / (N * numberOfEvents),
nano_t);
Utility class to parse command line options.
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
Various implementations of functional maps.
#define ASSERT(A)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for CPU timing and usage.
General purpose messaging.
Utility class to parse command line options.
double f5(const double x0, const double x1, const double x2, const double x3, const double x4)
5D function.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Double_t g1(const Double_t x)
Function.
int main(int argc, char *argv[])