00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 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_view> class multi_inte { 00043 00044 public: 00045 00046 /** \brief Verbosity 00047 */ 00048 int verbose; 00049 00050 /** \brief The maximum "uncertainty" in the value of the integral 00051 (default \f$ 10^{-8} \f$). 00052 */ 00053 double tolf; 00054 00055 multi_inte() { 00056 tolf=1.0e-8; 00057 verbose=0; 00058 interror=0.0; 00059 } 00060 00061 virtual ~multi_inte() {} 00062 00063 /** \brief Integrate function \c func over the hypercube from 00064 \f$ x_i=a_i \f$ to \f$ x_i=b_i \f$ for 00065 \f$ 0<i< \f$ ndim-1 00066 00067 \comment 00068 (I had some problems with Doxygen 00069 using \mathrm in the formula above.) 00070 \endcomment 00071 */ 00072 virtual double minteg(func_t &func, size_t ndim, const vec_t &a, 00073 const vec_t &b, param_t &pa)=0; 00074 00075 /** \brief Integrate function \c func over the hypercube from 00076 \f$ x_i=a_i \f$ to \f$ x_i=b_i \f$ for 00077 \f$ 0<i< \f$ ndim-1 00078 */ 00079 virtual int minteg_err(func_t &func, size_t ndim, const vec_t &a, 00080 const vec_t &b, param_t &pa, double &res, 00081 double &err) { 00082 res=minteg(func,ndim,a,b,pa); 00083 return 0; 00084 } 00085 00086 /** \brief Return the error in the result from the last call to 00087 minteg() or minteg_err() 00088 00089 This will quietly return zero if no integrations have been 00090 performed. 00091 */ 00092 double get_error() { return interror; } 00093 00094 /// Return string denoting type ("multi_inte") 00095 const char *type() { return "multi_inte"; } 00096 00097 #ifndef DOXYGEN_INTERNAL 00098 00099 protected: 00100 00101 /// The uncertainty for the last integration computation 00102 double interror; 00103 00104 #endif 00105 00106 }; 00107 00108 #ifndef DOXYGENP 00109 } 00110 #endif 00111 00112 #endif 00113 00114 00115 00116 00117 00118
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