1 #ifndef QNANO_NEW_INTEGRABLE_FUNCTION_DEFINED_H 2 #define QNANO_NEW_INTEGRABLE_FUNCTION_DEFINED_H 13 double (*
fct)(
double *d,
size_t dim,
void *params);
17 double evaluate(
const std::vector<double> &vec)
const{
18 return fct((
double*) &vec[0], vec.size(), params);
20 double evaluate(
double d)
const{
21 return fct(&d, 1, params);
24 Integrable_Function(
double (*fct_)(
double *d,
size_t dim,
void *params),
size_t dim_,
void *params_)
25 :
fct(fct_), dim(dim_), params(params_){
35 static double f(
double *x,
size_t dim,
void *params){
37 return exp(cl->a * x[0]);
51 static double f(
double *x,
size_t dim,
void *params){
53 return cl->if1->
fct(x, dim, (
void*)cl->if1)*cl->if2->
fct(x, dim, (
void*) cl->if2);
59 if(if1->dim!=if2->dim){
60 std::cerr<<
"Integrable_Function_Product: mismatch of dimension: "<<if1->dim<<
" vs. "<<if2->dim<<std::endl;
double(* fct)(double *d, size_t dim, void *params)
Integrable Function compatible with GSL Vegas algorithm.
Definition: Integrable_Function.h:13
Example for integrable function with parameter exp(a*x):
Definition: Integrable_Function.h:31
Interface for integrable functions.
Definition: Integrable_Function.h:10
Build Integrable_Function from product of other Integrable_Functions:
Definition: Integrable_Function.h:46