25int main(
int argc,
char **argv)
30 unsigned int numberOfEvents;
38 JParser<> zap(
"Example program to test 1D interpolation of a polynome.");
48 catch(
const exception &error) {
49 FATAL(error.what() << endl);
53 FATAL(
"Invalid polynomial.");
66 const double xmin = -1.0;
67 const double xmax = +1.0;
73 polint.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
78 for (
int i = 1; i != (int) f1.size(); ++i) {
79 fp.push_back(fp.rbegin()->getDerivative());
84 for (
int i = 0; i != (int) f1.size(); ++i) {
85 DEBUG(
' ' << fp[i](x0));
91 JResult_t result = polint(x0);
93 for (
int i = 0; i != N+1; ++i) {
94 DEBUG(
' ' << result.y[i]);
99 if (numberOfEvents != 0) {
103 for (
int j = 0; j !=
sizeof(Q)/
sizeof(Q[0]); ++j) {
112 const int M = min(fp.size(),
sizeof(Q)/
sizeof(Q[0]));
114 for (
unsigned int i = 0; i != numberOfEvents; ++i) {
116 const double x = gRandom->Uniform(xmin, xmax);
118 JResult_t result = polint(x);
120 for (
int j = 0; j != M; ++j) {
121 Q[j].
put(fp[j](x) - result.y[j]);
125 for (
int j = 0; j != M; ++j) {
126 Q[j].
print(cout, j == 0);
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int main(int argc, char **argv)
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.
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.