Example program to test 1D interpolation of a polynome.  
More...
#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include "TRandom3.h"
#include "JLang/JException.hh"
#include "JMath/JPolynome.hh"
#include "JTools/JFunction1D_t.hh"
#include "JTools/JGrid.hh"
#include "JTools/JQuantile.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
 
Go to the source code of this file.
 | 
| int  | main (int argc, char **argv) | 
|   | 
Example program to test 1D interpolation of a polynome. 
- Author
 - mdejong 
 
Definition in file JPolynome1P.cc.
 
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 25 of file JPolynome1P.cc.
   30   unsigned int  numberOfEvents;
 
   31   unsigned int  numberOfBins;
 
   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.");
 
   60   typedef JResultPolynome<N, double>                                                JResult_t;
 
   61   typedef JPolintFunction1D<N, JElement2D<double, double>, JCollection, JResult_t>  JFunction1D_t;
 
   67   const double xmin = -1.0;
 
   68   const double xmax = +1.0;  
 
   70   polint.configure(JGrid<double>(numberOfBins, xmin, xmax), f1);
 
   74   polint.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
 
   79   for (
int i = 1; i != (int) f1.size(); ++i) {
 
   80     fp.push_back(fp.rbegin()->getDerivative());
 
   85   for (
int i = 0; i != (int) f1.size(); ++i) {
 
   86     cout << 
' ' << fp[i](x0);
 
   93   JResult_t result = polint(x0);
 
   95   for (
int i = 0; i != N+1; ++i) {
 
   96     cout << 
' ' << result.y[i];
 
  102   if (numberOfEvents != 0) {
 
  106     for (
int j = 0; j != 
sizeof(Q)/
sizeof(Q[0]); ++j) {
 
  112       Q[j].setTitle(os.str());
 
  115     for (
unsigned int i = 0; i != numberOfEvents; ++i) {
 
  117       const double x   = gRandom->Uniform(xmin, xmax);
 
  119       JResult_t result = polint(x);
 
  121       for (
int j = 0; j != 
sizeof(Q)/
sizeof(Q[0]); ++j) {
 
  122         Q[j].put(fp[j](x) - result.y[j]);
 
  126     for (
int j = 0; j != 
sizeof(Q)/
sizeof(Q[0]); ++j) {
 
  127       Q[j].print(cout, j == 0);
 
Utility class to parse command line options. 
 
static const JZero zero
Function object to assign zero value. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object