IT++ Logo
integration.cpp
Go to the documentation of this file.
1 
30 
32 namespace itpp
33 {
34 
35 //wrapper to convert double(*f)(double) to function object
36 class Integrand_Wrapper
37 {
38  typedef double(*Ftn)(double);
39  Ftn _f;
40 public:
41  explicit Integrand_Wrapper(Ftn f): _f(f) {}
42  double operator()(double x) const {return _f(x);}
43 };
44 
45 
46 template double quad(Integrand_Wrapper, double, double, double);
47 template double quadl(Integrand_Wrapper, double, double, double);
48 
49 //--------------------- quad() ----------------------------------------
50 double quad(double(*f)(double), double a, double b,
51  double tol)
52 {
53  return quad(Integrand_Wrapper(f), a, b, tol);
54 }
55 
56 //--------------------- quadl() ----------------------------------------
57 double quadl(double(*f)(double), double a, double b, double tol)
58 {
59  return quadl(Integrand_Wrapper(f), a, b, tol);
60 }
61 
62 
63 } // namespace itpp
64 
66 
67 
SourceForge Logo

Generated on Sat Jul 6 2013 10:54:21 for IT++ by Doxygen 1.8.2