26{
29
30 unsigned int numberOfEvents;
33 double x0;
35
36 try {
37
38 JParser<> zap(
"Example program to test 1D interpolation of a polynome.");
39
45
46 zap(argc, argv);
47 }
48 catch(const exception &error) {
49 FATAL(error.what() << endl);
50 }
51
53 FATAL(
"Invalid polynomial.");
54 }
55
56
57 const int N = 3;
58
61
62
63 JFunction1D_t polint;
64
65
66 const double xmin = -1.0;
67 const double xmax = +1.0;
68
70
71 polint.compile();
72
73 polint.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
74
75
77
78 for (
int i = 1; i != (int)
f1.size(); ++i) {
79 fp.push_back(fp.rbegin()->getDerivative());
80 }
81
83
84 for (
int i = 0; i != (int)
f1.size(); ++i) {
85 DEBUG(
' ' << fp[i](x0));
86 }
88
90
91 JResult_t
result = polint(x0);
92
93 for (int i = 0; i != N+1; ++i) {
95 }
97
98
99 if (numberOfEvents != 0) {
100
102
103 for (
int j = 0;
j !=
sizeof(Q)/
sizeof(Q[0]); ++
j) {
104
105 ostringstream os;
106
108
110 }
111
112 const int M = min(fp.size(), sizeof(Q)/sizeof(Q[0]));
113
114 for (unsigned int i = 0; i != numberOfEvents; ++i) {
115
116 const double x = gRandom->Uniform(xmin, xmax);
117
118 JResult_t
result = polint(x);
119
120 for (
int j = 0;
j != M; ++
j) {
122 }
123 }
124
125 for (
int j = 0;
j != M; ++
j) {
127 }
128 }
129}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int numberOfBins
number of bins for average CDF integral of optical module
void setTitle(const std::string &title)
Set title.
Utility class to parse command line options.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
static const JZero zero
Function object to assign zero value.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Recursive template class for polynomial function.