Object-oriented Scientific Computing Library: Version 0.910
gsl_inte_qagi.h
00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006-2012, Jerry Gagelman
00005   and Andrew W. Steiner
00006   
00007   This file is part of O2scl.
00008   
00009   O2scl is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation; either version 3 of the License, or
00012   (at your option) any later version.
00013   
00014   O2scl is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018   
00019   You should have received a copy of the GNU General Public License
00020   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00021 
00022   -------------------------------------------------------------------
00023 */
00024 #ifndef O2SCL_GSL_INTE_QAGI_H
00025 #define O2SCL_GSL_INTE_QAGI_H
00026 
00027 #include <o2scl/inte.h>
00028 #include <o2scl/gsl_inte_qags.h>
00029 
00030 #ifndef DOXYGENP
00031 namespace o2scl {
00032 #endif
00033 
00034   /** \brief Integrate a function over the interval \f$
00035       (-\infty,\infty) \f$ (GSL)
00036       
00037       See \ref gslinte_subsect in the User's guide for general
00038       information about the GSL integration classes.
00039   */
00040   template<class func_t=funct > class gsl_inte_qagi : 
00041   public gsl_inte_transform<func_t> {
00042     
00043     public:
00044       
00045     /** \brief Integrate function \c func from \f$ \infty \f$ 
00046         to \f$ \infty \f$ giving result \c res and error \c err
00047         
00048         The values \c a and \c b are ignored
00049     */
00050     virtual int integ_err(func_t &func, double a, double b, 
00051                           double &res, double &err) {
00052       this->last_conv=0;
00053       return qags(func,0.0,1.0,this->tol_abs,this->tol_rel,&res,&err);
00054     }
00055     
00056 #ifndef DOXYGEN_INTERNAL
00057     
00058     protected:
00059     
00060     /// Tranformation to \f$ t \in (0,1] \f$ 
00061     virtual double transform(double t, func_t &func) {
00062       double x=(1-t)/t, y1, y2;
00063       y1=func(x);
00064       y2=func(-x);
00065       return (y1+y2)/t/t;
00066     }
00067     
00068 #endif
00069       
00070     };
00071   
00072 #ifndef DOXYGENP
00073 }
00074 #endif
00075 
00076 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.