65 JParser<> zap(
"Example program to test multi-dimensional interpolation.");
77 catch(
const exception &error) {
78 FATAL(error.what() << endl);
82 const double xmin = -1.0;
83 const double xmax = +1.0;
91 JMap_t>::maplist JMaplist_t;
94 typedef JMultiFunction_t::result_type result_type;
100 for (
double y =
xmin;
y <
xmax + 0.5*dx;
y += dx) {
101 for (
double z =
xmin; z <
xmax + 0.5*dx; z += dx) {
111 if (numberOfEvents > 0) {
116 for (
int i = 0; i != numberOfEvents; ++i) {
118 const double x = gRandom->Uniform(
xmin,
xmax);
119 const double y = gRandom->Uniform(
xmin,
xmax);
120 const double z = gRandom->Uniform(
xmin,
xmax);
122 const result_type
result = g3(
x,
y,z);
124 const double v =
f3(
x,
y,z);
129 H[0][0].put(fx.getDerivative().getDerivative(
x) * fy(
y) * fz(z) -
result.fpp.f.f);
130 H[1][0].put(fx.getDerivative(
x) * fy.getDerivative(
y) * fz(z) -
result.fp.fp.f);
131 H[2][0].put(fx.getDerivative(
x) * fy(
y) * fz.getDerivative(z) -
result.fp.f.fp);
133 H[1][1].put(fx(
x) * fy.getDerivative().getDerivative(
y) * fz(z) -
result.f.fpp.f);
134 H[2][1].put(fx(
x) * fy.getDerivative(
y) * fz.getDerivative(z) -
result.f.fp.fp);
136 H[2][2].put(fx(
x) * fy(
y) * fz.getDerivative().getDerivative(z) -
result.f.f.fpp);
143 cout <<
"Hessian matrix" << endl;
145 for (
int i = 0; i != N; ++i) {
146 for (
int j = 0;
j <= i; ++
j) {
152 for (
int i = 0; i != N; ++i) {
153 for (
int j = 0;
j <= i; ++
j) {
163 for (
int i = 0; i != N; ++i) {
164 for (
int j = 0;
j <= i; ++
j) {
166 ASSERT(
H[i][
j].getSTDev() <= precision);
174 cout <<
"> " << flush;
178 if (
getline(cin, buffer) && !buffer.empty()) {
182 istringstream(buffer) >>
x >>
y >> z;
188 cout << exception << endl;
double getMean(vector< double > &v)
get mean of vector content
#define ASSERT(A,...)
Assert macro.
#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 numberOfBins
number of bins for average CDF integral of optical module
Utility class to parse command line options.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
const parameter_list< JPolynome< ID_t, 0 > > JPolynome< ID_t, 0 >::parameters & JPolynome
Set parameters.
static const double H
Planck constant [eV s].
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.