SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2013 Roman Votyakov 00008 * 00009 * The abscissae and weights for Gauss-Kronrod rules are taken form 00010 * QUADPACK, which is in public domain. 00011 * http://www.netlib.org/quadpack/ 00012 * 00013 * See method comments which functions are adapted from GNU Octave, 00014 * file quadgk.m: Copyright (C) 2008-2012 David Bateman under GPLv3 00015 * http://www.gnu.org/software/octave/ 00016 */ 00017 00018 #ifndef _INTEGRATION_H_ 00019 #define _INTEGRATION_H_ 00020 00021 #include <shogun/lib/config.h> 00022 00023 #ifdef HAVE_EIGEN3 00024 00025 #include <shogun/base/SGObject.h> 00026 #include <shogun/lib/DynamicArray.h> 00027 #include <shogun/mathematics/Math.h> 00028 #include <shogun/mathematics/Function.h> 00029 00030 namespace shogun 00031 { 00032 00036 class CIntegration : public CSGObject 00037 { 00038 public: 00067 static float64_t integrate_quadgk(CFunction* f, float64_t a, 00068 float64_t b, float64_t abs_tol=1e-10, float64_t rel_tol=1e-5, 00069 uint32_t max_iter=1000, index_t sn=10); 00070 00092 static float64_t integrate_quadgh(CFunction* f); 00093 00098 virtual const char* get_name() const { return "Integration"; } 00099 00100 private: 00116 static void evaluate_quadgk(CFunction* f, CDynamicArray<float64_t>* subs, 00117 CDynamicArray<float64_t>* q, CDynamicArray<float64_t>* err, index_t n, 00118 float64_t* xgk, float64_t* wg, float64_t* wgk); 00119 00135 static void evaluate_quadgk15(CFunction* f, CDynamicArray<float64_t>* subs, 00136 CDynamicArray<float64_t>* q, CDynamicArray<float64_t>* err); 00137 00153 static void evaluate_quadgk21(CFunction* f, CDynamicArray<float64_t>* subs, 00154 CDynamicArray<float64_t>* q, CDynamicArray<float64_t>* err); 00155 00167 static float64_t evaluate_quadgh(CFunction* f, index_t n, float64_t* xh, 00168 float64_t* wh); 00169 00183 static float64_t evaluate_quadgh64(CFunction* f); 00184 }; 00185 } 00186 #endif /* HAVE_EIGEN3 */ 00187 #endif /* _INTEGRATION_H_ */