23 inline double f3(
const double x, 
const double y, 
const double z)
 
   25   static const double a = 1.0;
 
   26   static const double b = 1.0;
 
   27   static const double c = 1.0;
 
   30     x * (a + x * (b + c*x))  *  
 
   31     y * (a + y * (b + c*y))  *
 
   32     z * (a + z * (b + c*z));
 
   42 int main(
int argc, 
char **argv)
 
   54     JParser<> zap(
"Example program to test multi-dimensional interpolation.");
 
   63   catch(
const exception &error) {
 
   64     FATAL(error.what() << endl);
 
   68   const double xmin = -1.0;
 
   69   const double xmax = +1.0;
 
   70   const double dx   = (xmax - xmin) / (numberOfBins - 1);
 
   73   typedef JGridPolint3Function1D_t                          JFunction1D_t;
 
   75   typedef JMAPLIST<JPolint3FunctionalGridMap,
 
   76                    JPolint3FunctionalGridMap>::maplist      JMaplist_t;
 
   78   typedef JMultiFunction<JFunction1D_t, JMaplist_t>         JMultiFunction_t;
 
   84   for (
double x = xmin; x < xmax + 0.5*dx; x += dx) {
 
   85     for (
double y = xmin; y < xmax + 0.5*dx; y += dx) {
 
   86       for (
double z = xmin; z < xmax + 0.5*dx; z += dx) {
 
   87         g3[x][y][z] = 
f3(x,y,z);
 
   94   g3.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
 
   97   if (numberOfEvents > 0) {
 
  103     for (
int i = 0; i != numberOfEvents; ++i) {
 
  105       const double x  = gRandom->Uniform(xmin, xmax);
 
  106       const double y  = gRandom->Uniform(xmin, xmax);
 
  107       const double z  = gRandom->Uniform(xmin, xmax);
 
  109       const double v  = 
f3(x,y,z);
 
  113       const double w  = g3(x,y,z);
 
  124       timer.print(cout, 1.0 / numberOfEvents, 
micro_t);
 
  127     ASSERT(Q.getMean()  <= precision);
 
  128     ASSERT(Q.getSTDev() <= precision);
 
  134       cout << 
"> " << flush;
 
  138       if (
getline(cin, buffer) && !buffer.empty()) {
 
  142         istringstream(buffer) >> x >> y >> z;
 
  145           cout << 
f3(x,y,z) << 
' ' << g3(x,y,z) << endl;
 
  147         catch(
const JException& exception) {
 
  148           cout << exception << endl;