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_SERIES_H 00024 #define O2SCL_GSL_SERIES_H 00025 00026 #include <iostream> 00027 #include <o2scl/collection.h> 00028 #include <gsl/gsl_sum.h> 00029 00030 #ifndef DOXYGENP 00031 namespace o2scl { 00032 #endif 00033 00034 /** 00035 \brief Series acceleration by Levin u-transform (GSL) 00036 00037 Given an array of terms in a sum, this attempts to evaluate the 00038 entire sum with an estimate of the error. 00039 00040 \future Convert to use a more general vector 00041 */ 00042 class gsl_series { 00043 public: 00044 00045 /** \brief \c size is the number of terms in the series 00046 */ 00047 gsl_series(int size=1); 00048 00049 virtual ~gsl_series(); 00050 00051 /** \brief Return the accelerated sum of the series with 00052 a simple error estimate 00053 */ 00054 double series_accel(double *x, double &err); 00055 00056 /** \brief Return the accelerated sum of the series with 00057 an accurate error estimate 00058 */ 00059 double series_accel_err(double *x, double &err); 00060 00061 /** \brief Set the number of terms */ 00062 int set_size(int new_size); 00063 00064 #ifndef DOXYGENP 00065 00066 protected: 00067 00068 /// The GSL workspace 00069 gsl_sum_levin_u_workspace *w; 00070 00071 /// The GSL workspace 00072 gsl_sum_levin_utrunc_workspace *wt; 00073 00074 /// The workspace size 00075 int size; 00076 00077 #endif 00078 00079 }; 00080 00081 #ifndef DOXYGENP 00082 } 00083 #endif 00084 00085 #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