42 result_type(
const double __f,
58 operator double()
const
95 inline result_type operator()(
const double x,
99 return result_type(f (x) * f (y) * f (z),
100 fp(x) * f (y) * f (z),
101 f (x) * fp(y) * f (z),
102 f (x) * f (y) * fp(z));
113 inline double f(
const double x)
const
115 return __f1.getValue(x);
125 inline double fp(
const double x)
const
127 return __f1.getDerivative(x);
142 template<
class JMultiFunction_t>
143 int do_main(
int argc,
char **argv,
const char* title)
155 JParser<> zap(
"Example program to test multi-dimensional interpolation with derivatives.");
164 catch(
const exception &error) {
165 FATAL(error.what() << endl);
169 if (numberOfEvents <= 0) {
FATAL(
"Number of events " << numberOfEvents << endl); }
173 const JFunction3D
f3(f1);
175 const double xmin = -1.0;
176 const double xmax = +1.0;
182 for (
double x = xmin;
x < xmax + 0.5*dx;
x += dx) {
183 for (
double y = xmin;
y < xmax + 0.5*dx;
y += dx) {
184 for (
double z = xmin; z < xmax + 0.5*dx; z += dx) {
185 g3[
x][
y][z] =
f3(x,y,z);
199 for (
int i = 0; i != numberOfEvents; ++i) {
201 const double x = gRandom->Uniform(xmin, xmax);
202 const double y = gRandom->Uniform(xmin, xmax);
203 const double z = gRandom->Uniform(xmin, xmax);
205 const JFunction3D ::result_type u =
f3(x,y,z);
206 const typename JMultiFunction_t::result_type v = g3(x,y,z);
208 f .put(u.f - v.f .f .f);
209 fx.put(u.fx - v.fp.f .f);
210 fy.put(u.fy - v.f .fp.f);
211 fz.put(u.fz - v.f .f .fp);
214 cout << endl << title <<
":" << endl;
216 for (
const JStats* p : { &f, &fx, &fy, &fz }) {
217 p->print(cout, p == &f);
241 if (do_main<JMultiFunction_t>(argc, argv,
"Polint") != 0)
return 1;
250 if (do_main<JMultiFunction_t>(argc, argv,
"Spline") != 0)
return 1;
Various implementations of functional maps.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double f3(const double x, const double y, const double z)
3D function.
int main(int argc, char **argv)
int numberOfBins
number of bins for average CDF integral of optical module
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Recursive template class for polynomial function.