gen_inte.h

00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, 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_GEN_INTE_H
00024 #define O2SCL_GEN_INTE_H
00025 
00026 #ifndef DOXYGENP
00027 namespace o2scl {
00028 #endif
00029   
00030   /** 
00031       \brief Generalized multi-dimensional integration base
00032  
00033       In order to allow the user to specify only three functions (for
00034       the integrand, the lower limits, and the upper limits) the first
00035       integer variable is used to distinguish among the variable
00036       limits. So the function \f$ a_0() \f$ is just lower(0,NULL,vp)
00037       where vp is a void pointer, the function \f$ a_1 \f$ is
00038       lower(1,x,vp) where x is a 1-dimensional vector, and the
00039       function \f$ a_i \f$ is lower(i,x,vp) where x is an
00040       i-dimensional vector. Similarly, the function \f$ b_i \f$ is
00041       upper(i,x,vp) where x is an i-dimensional vector.
00042   */
00043   template<class param_t, class func_t, class lfunc_t, class ufunc_t,
00044     class vec_t=ovector_view> class gen_inte {
00045 
00046   
00047       public:
00048   
00049       /** \brief Verbosity
00050        */
00051       int verbose;
00052       
00053       /** \brief The maximum "uncertainty" in the value of the integral
00054        */
00055       double tolf;
00056   
00057       gen_inte() 
00058       {
00059         tolf=1.0e-8;
00060         verbose=0;
00061         interror=0.0;
00062       }
00063   
00064       /** \brief Integrate function \c func from
00065           \f$ x_i=f_i(x_i) \f$ to \f$ x_i=g_i(x_i) \f$ for
00066           \f$ 0<i<\mathrm{ndim}-1 \f$.
00067  
00068       */
00069       double ginteg(func_t &func, size_t ndim, lfunc_t &a, ufunc_t &b,
00070                     param_t &pa) 
00071       {
00072         return 0;
00073       }
00074   
00075       /** \brief Integrate function \c func from
00076           \f$ x_i=f_i(x_i) \f$ to \f$ x_i=g_i(x_i) \f$ for
00077           \f$ 0<i<\mathrm{ndim}-1 \f$.
00078  
00079       */
00080       int ginteg_err(func_t &func, size_t ndim, lfunc_t &a, ufunc_t &b, 
00081                      param_t &pa, double &res, double &err)
00082       {
00083         return 0;
00084       }
00085   
00086       /** \brief Return the error in the result from the last call to 
00087           ginteg() or ginteg_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 ("gen_inte")
00095       const char *type() { return "gen_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 SourceForge.net Logo, O2scl Sourceforge Project Page