00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 2009, Andrew W. Steiner 00005 00006 This file is part of O2scl. 00007 00008 O2scl is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 O2scl is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with O2scl. If not, see <http://www.gnu.org/licenses/>. 00020 00021 ------------------------------------------------------------------- 00022 */ 00023 #ifndef O2SCL_MULTI_INTE_H 00024 #define O2SCL_MULTI_INTE_H 00025 00026 #include <o2scl/inte.h> 00027 #include <o2scl/ovector_tlate.h> 00028 00029 #ifndef DOXYGENP 00030 namespace o2scl { 00031 #endif 00032 00033 /** 00034 \brief Multi-dimensional integration over a hypercube 00035 [abstract base] 00036 00037 Multi-dimensional integration over a region defined by constant 00038 limits. For more general regions of integration, use children of 00039 the class \ref gen_inte. 00040 */ 00041 template<class param_t, class func_t, 00042 class vec_t=ovector_base> class multi_inte { 00043 00044 public: 00045 00046 multi_inte() { 00047 tolf=1.0e-8; 00048 verbose=0; 00049 interror=0.0; 00050 err_nonconv=true; 00051 } 00052 00053 virtual ~multi_inte() {} 00054 00055 /// If true, call the error handler if the routine does not "converge" 00056 bool err_nonconv; 00057 00058 /** \brief Verbosity 00059 */ 00060 int verbose; 00061 00062 /** \brief The maximum "uncertainty" in the value of the integral 00063 (default \f$ 10^{-8} \f$). 00064 */ 00065 double tolf; 00066 00067 /** \brief Integrate function \c func over the hypercube from 00068 \f$ x_i=a_i \f$ to \f$ x_i=b_i \f$ for 00069 \f$ 0<i< \f$ ndim-1 00070 00071 \comment 00072 (I had some problems with Doxygen 00073 using \mathrm in the formula above.) 00074 \endcomment 00075 */ 00076 virtual double minteg(func_t &func, size_t ndim, const vec_t &a, 00077 const vec_t &b, param_t &pa) { 00078 double err, res; 00079 minteg_err(func,ndim,a,b,pa,res,err); 00080 return res; 00081 } 00082 00083 /** \brief Integrate function \c func over the hypercube from 00084 \f$ x_i=a_i \f$ to \f$ x_i=b_i \f$ for 00085 \f$ 0<i< \f$ ndim-1 00086 */ 00087 virtual int minteg_err(func_t &func, size_t ndim, const vec_t &a, 00088 const vec_t &b, param_t &pa, double &res, 00089 double &err)=0; 00090 00091 /** \brief Return the error in the result from the last call to 00092 minteg() or minteg_err() 00093 00094 This will quietly return zero if no integrations have been 00095 performed. 00096 */ 00097 double get_error() { return interror; } 00098 00099 /// Return string denoting type ("multi_inte") 00100 const char *type() { return "multi_inte"; } 00101 00102 #ifndef DOXYGEN_INTERNAL 00103 00104 protected: 00105 00106 /// The uncertainty for the last integration computation 00107 double interror; 00108 00109 #endif 00110 00111 }; 00112 00113 #ifndef DOXYGENP 00114 } 00115 #endif 00116 00117 #endif 00118 00119 00120 00121 00122 00123
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page