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 /* 00024 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough 00025 * 00026 * This program is free software; you can redistribute it and/or modify 00027 * it under the terms of the GNU General Public License as published by 00028 * the Free Software Foundation; either version 3 of the License, or (at 00029 * your option) any later version. 00030 * 00031 * This program is distributed in the hope that it will be useful, but 00032 * WITHOUT ANY WARRANTY; without even the implied warranty of 00033 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00034 * General Public License for more details. 00035 * 00036 * You should have received a copy of the GNU General Public License 00037 * along with this program; if not, write to the Free Software 00038 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00039 * 02110-1301, USA. 00040 */ 00041 #ifndef O2SCL_GSL_INTE_H 00042 #define O2SCL_GSL_INTE_H 00043 00044 #include <gsl/gsl_machine.h> 00045 00046 #ifndef DOXYGENP 00047 namespace o2scl { 00048 #endif 00049 00050 /** 00051 \brief GSL integration base 00052 00053 This base class does not perform any actual integration, but 00054 just provides functions to be used in the integration 00055 classes based on GSL. 00056 */ 00057 class gsl_inte { 00058 00059 public: 00060 00061 gsl_inte() { 00062 } 00063 00064 protected: 00065 00066 /** 00067 \brief Rescale errors appropriately 00068 */ 00069 double rescale_error(double err, const double result_abs, 00070 const double result_asc) { 00071 err = fabs(err); 00072 00073 if (result_asc != 0 && err != 0) { 00074 00075 double scale = pow((200 * err / result_asc), 1.5); 00076 00077 if (scale < 1) { 00078 err = result_asc * scale; 00079 } else { 00080 err = result_asc; 00081 } 00082 } 00083 00084 if (result_abs > GSL_DBL_MIN / (50 * GSL_DBL_EPSILON)) { 00085 00086 double min_err = 50 * GSL_DBL_EPSILON * result_abs; 00087 00088 if (min_err > err) { 00089 err = min_err; 00090 } 00091 } 00092 00093 return err; 00094 } 00095 00096 }; 00097 00098 00099 #ifndef DOXYGENP 00100 } 00101 #endif 00102 00103 #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