23 #ifndef O2SCL_COMP_GEN_INTE_H
24 #define O2SCL_COMP_GEN_INTE_H
32 #include <boost/numeric/ublas/vector.hpp>
34 #include <o2scl/funct.h>
35 #include <o2scl/inte.h>
36 #include <o2scl/inte_gen.h>
38 #ifndef DOXYGEN_NO_O2NS
77 template<
class func_t,
class lfunc_t=func_t,
80 public inte_gen<func_t,lfunc_t,ufunc_t,vec_t> {
82 #ifndef DOXYGEN_INTERNAL
116 O2SCL_ERR(
"Index >= max_dim in inte_multi_comp::set_oned_inte().",
127 }
else if (i>
nint-1) {
134 bool *tptrs_new=
new bool[nint_new];
136 for(
size_t j=0;j<
nint;j++) {
137 iptrs_new[j]=
iptrs[j];
138 tptrs_new[j]=
tptrs[j];
160 virtual double ginteg(func_t &func,
size_t n, func_t &lower,
164 bool enough_oned=
true;
165 if (n>
nint) enough_oned=
false;
166 for(
size_t i=0;i<n;i++) {
167 if (
tptrs[i]==
false) enough_oned=
false;
170 if (enough_oned==
false) {
171 O2SCL_ERR(
"Too few objects specified with set_ptrs() in minteg().",
187 std::bind(std::mem_fn<
double(
double,
size_t &)>
189 this,std::placeholders::_1,ix);
190 double res=
iptrs[0]->
integ(fmn,lower(0,c),upper(0,c));
196 virtual const char *
type() {
return "inte_gen_comp"; }
201 #ifndef DOXYGEN_INTERNAL
212 res=(*mf)(
ndim,(*cx));
215 res=(*mf)(ix_next,*
cx);
218 std::bind(std::mem_fn<
double(
double,
size_t &)>
220 this,std::placeholders::_1,ix_next);
242 #ifndef DOXYGEN_NO_O2NS
size_t max_dim
The maxiumum number of integration dimensions (default 100)
std::function< double(double)> funct11
One-dimensional function typedef.
size_t nint
The size of the integration object arrays.
invalid argument supplied by user
Generalized multi-dimensional integration [abstract base].
vec_t * cx
The independent variable vector.
size_t ndim
The number of dimensions.
virtual double integ(func_t &func, double a, double b)
Integrate function func from a to b.
lfunc_t * lowerp
The function specifying the lower limits.
ufunc_t * upperp
The function specifying the upper limits.
int set_oned_inte(inte<> &it, size_t i)
Set the one-dimensional integration object with index i.
Base integration class [abstract base].
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
double odfunc(double x, size_t &ix)
The one-dimensional integration function.
inte ** iptrs
Pointers to the integration objects.
virtual const char * type()
Return string denoting type ("inte_gen_comp")
virtual double ginteg(func_t &func, size_t n, func_t &lower, func_t &upper)
Integrate function func from to for .
Naive generalized multi-dimensional integration.
func_t * mf
The function to be integrated.
bool * tptrs
Flag indicating if integration object has been set.