33 inline double f3(
const double x,
const double y,
const double z)
35 return fx(x) * fy(y) * fz(z);
38 template<
class JKey_t,
class JValue_t,
class JDistance_t>
40 public JPolintMap<N, JKey_t, JValue_t, JGridMap,
41 JResultHesse<typename JResultType<JValue_t>::result_type>,
53 int main(
int argc,
char **argv)
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;
185 cout <<
f3(x,y,z) <<
' ' <<
get_value(g3(x,y,z)) << endl;
188 cout << exception << endl;
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
The elements in a collection are sorted according to their abscissa values and a given distance opera...
static const double H
Planck constant [eV s].
double getMean(vector< double > &v)
get mean of vector content
#define ASSERT(A,...)
Assert macro.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
General purpose messaging.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Utility class to parse command line options.
double f3(const double x, const double y, const double z)
3D function.
Polynome function object.
Auxiliary data structure for floating point format specification.
int numberOfBins
number of bins for average CDF integral of optical module