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_GSL_INTE_QAGS_H 00024 #define O2SCL_GSL_INTE_QAGS_H 00025 00026 #include <o2scl/inte.h> 00027 #include <o2scl/funct.h> 00028 #include <o2scl/gsl_inte_qag.h> 00029 00030 #ifndef DOXYGENP 00031 namespace o2scl { 00032 #endif 00033 00034 /** \brief Integrate a function with a singularity (GSL) 00035 00036 The number of subdivisions of the original interval which 00037 this class is allowed to make is dictated by the workspace 00038 size for the integration class, which can be set using 00039 \ref gsl_inte_table::set_wkspace() . 00040 00041 \todo The convergence errors need to be handled correctly 00042 in function <tt>qags</tt> in <tt>gsl_inte_qag_b.h</tt>. 00043 00044 */ 00045 template<class param_t, class func_t=funct<param_t> > class gsl_inte_qags : 00046 public gsl_inte_singular<param_t,func_t> { 00047 00048 public: 00049 00050 /** \brief Integrate function \c func from \c a to \c b. 00051 */ 00052 virtual double integ(func_t &func, double a, double b, param_t &pa) { 00053 double res, err; 00054 integ_err(func,a,b,pa,res,err); 00055 this->interror=err; 00056 return res; 00057 } 00058 00059 /** \brief Integrate function \c func from \c a to \c b and place 00060 the result in \c res and the error in \c err 00061 */ 00062 virtual int integ_err(func_t &func, double a, double b, 00063 param_t &pa, double &res, double &err2) { 00064 00065 double fv1[11], fv2[11]; 00066 00067 int status=qags(func,11,o2scl_inte_qag_coeffs::qk21_xgk, 00068 o2scl_inte_qag_coeffs::qk21_wg, 00069 o2scl_inte_qag_coeffs::qk21_wgk, 00070 fv1,fv2,a,b,this->tolx,this->tolf,this->wkspace, 00071 &res,&err2,pa); 00072 00073 return status; 00074 00075 } 00076 00077 00078 }; 00079 00080 #ifndef DOXYGENP 00081 } 00082 #endif 00083 00084 #endif
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