44 result_type(
const double __f,
60 operator double()
const
97 inline result_type operator()(
const double x,
101 return result_type(f (x) * f (y) * f (z),
102 fp(x) * f (y) * f (z),
103 f (x) * fp(y) * f (z),
104 f (x) * f (y) * fp(z));
119 inline double operator()(
const double xmin,
const double xmax,
120 const double ymin,
const double ymax,
121 const double zmin,
const double zmax)
const
123 return ((__f1.getIntegral(xmax) - __f1.getIntegral(xmin)) *
124 (__f1.getIntegral(ymax) - __f1.getIntegral(ymin)) *
125 (__f1.getIntegral(zmax) - __f1.getIntegral(zmin)));
136 inline double f(
const double x)
const
138 return __f1.getValue(x);
148 inline double fp(
const double x)
const
150 return __f1.getDerivative(x);
165 template<
class JMultiFunction_t>
166 int do_main(
int argc,
char **argv,
const char* title)
175 precision[
"spline"] = 1.0e-3;
176 precision[
"polint"] = 1.0e-10;
180 JParser<> zap(
"Example program to test multi-dimensional integration.");
189 catch(
const exception &error) {
190 FATAL(error.what() << endl);
201 const JFunction3D
f3(f1);
203 const double xmin = -1.0;
204 const double xmax = +1.0;
210 for (
double x = xmin;
x <
xmax + 0.5*dx;
x += dx) {
211 for (
double y = xmin;
y <
xmax + 0.5*dx;
y += dx) {
212 for (
double z = xmin; z <
xmax + 0.5*dx; z += dx) {
213 g3[
x][
y][z] =
f3(x,y,z);
223 << setw(8) << left << title <<
' '
224 << setw(12) << right <<
"real" <<
' '
225 << setw(12) << right <<
"calculated" << endl;
226 cout << setw(8) << left <<
"integral";
227 cout <<
' ' <<
SCIENTIFIC(12,4) <<
f3(xmin, xmax, xmin, xmax, xmin, xmax);
232 ASSERT(fabs(
f3(xmin, xmax, xmin, xmax, xmin, xmax) -
getIntegral(g3)) <= precision[title] *
f3(xmin, xmax, xmin, xmax, xmin, xmax));
256 if (do_main<JMultiFunction_t>(argc, argv,
"polint") != 0)
return 1;
265 if (do_main<JMultiFunction_t>(argc, argv,
"spline") != 0)
return 1;
Various implementations of functional maps.
General purpose messaging.
#define ASSERT(A,...)
Assert macro.
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)
I/O formatting auxiliaries.
int numberOfBins
number of bins for average CDF integral of optical module
Utility class to parse command line options.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
const parameter_list< JPolynome< ID_t, 0 > > JPolynome< ID_t, 0 >::parameters & JPolynome
Set parameters.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Recursive template class for polynomial function.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.