core/vnl/algo/vnl_adaptsimpson_integral.h
Go to the documentation of this file.
00001 #ifndef VNL_ADAPTSIMPSON_INTEGRAL_H_
00002 #define VNL_ADAPTSIMPSON_INTEGRAL_H_
00003 //:
00004 // \file
00005 // \author Kongbin Kang at Brown
00006 // \date   Jan. 17th, 2005
00007 //
00008 #include <vnl/vnl_definite_integral.h>
00009 
00010 class vnl_adaptsimpson_integral : public vnl_definite_integral
00011 {
00012  private:
00013   //: used to wrap the function class to an ordinary function.
00014   static double int_fnct_(double* x);
00015 
00016  protected:
00017 
00018   //: maximum recursion depth
00019   int depth_;
00020 
00021   //: real computation
00022   double  adaptivesimpson(double(*f)(double*), double a, double b, double eps, int level, int level_max);
00023 
00024  public:
00025   vnl_adaptsimpson_integral(int depth = 32) : depth_(depth) {}
00026 
00027   //: a and b are integral limits respectively.
00028   // n is the number of intervals used in integral.
00029   // accuracy is the accuracy you want to achieve. Normally accuracy > 1e-11)
00030   double integral(vnl_integrant_fnct *f, double a, double b, double accuracy);
00031 };
00032 
00033 #endif