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_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 \todo Covert to use a more general vector 00041 00042 */ 00043 class gsl_series { 00044 public: 00045 00046 /** \brief \c size is the number of terms in the series 00047 */ 00048 gsl_series(int size=1); 00049 00050 virtual ~gsl_series(); 00051 00052 /** \brief Return the accelerated sum of the series with 00053 a simple error estimate 00054 */ 00055 double series_accel(double *x, double &err); 00056 00057 /** \brief Return the accelerated sum of the series with 00058 an accurate error estimate 00059 */ 00060 double series_accel_err(double *x, double &err); 00061 00062 /** \brief Set the number of terms */ 00063 int set_size(int new_size); 00064 00065 #ifndef DOXYGENP 00066 00067 friend class io_tlate<gsl_series>; 00068 00069 protected: 00070 00071 /// The GSL workspace 00072 gsl_sum_levin_u_workspace *w; 00073 00074 /// The GSL workspace 00075 gsl_sum_levin_utrunc_workspace *wt; 00076 00077 /// The workspace size 00078 int size; 00079 00080 #endif 00081 00082 }; 00083 00084 template<> int io_tlate<gsl_series>::input 00085 (cinput *co, in_file_format *ins, gsl_series *gs); 00086 template<> int io_tlate<gsl_series>::output 00087 (coutput *co, out_file_format *outs, gsl_series *gs); 00088 template<> const char *io_tlate<gsl_series>::type(); 00089 00090 typedef io_tlate<gsl_series> gsl_series_io_type; 00091 00092 #ifndef DOXYGENP 00093 } 00094 #endif 00095 00096 #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