MathTL
|
00001 // -*- c++ -*- 00002 00003 // +--------------------------------------------------------------------+ 00004 // | This file is part of MathTL - the Mathematical Template Library | 00005 // | | 00006 // | Copyright (c) 2002-2009 | 00007 // | Thorsten Raasch, Manuel Werner | 00008 // +--------------------------------------------------------------------+ 00009 00010 #ifndef _MATHTL_EXTRAPOLATION_H 00011 #define _MATHTL_EXTRAPOLATION_H 00012 00013 #include <algebra/triangular_matrix.h> 00014 00015 namespace MathTL 00016 { 00020 class RombergSequence 00021 { 00022 public: 00023 unsigned int n(const unsigned int k) const { return 1<<(k-1); } 00024 }; 00025 00029 class BulirschSequence 00030 { 00031 public: 00032 unsigned int n(const unsigned int k) const 00033 { 00034 return (k == 1 00035 ? 1 00036 : (k%2 == 0 00037 ? 1<<(k/2) 00038 : 3*(1<<((k/2)-1)))); 00039 } 00040 }; 00041 00045 class HarmonicSequence 00046 { 00047 public: 00048 unsigned int n(const unsigned int k) const { return k; } 00049 }; 00050 00073 template <class ALGORITHM, class RESULT = double, class SEQUENCE = RombergSequence> 00074 class ExtrapolationTable 00075 { 00076 public: 00080 ExtrapolationTable(const ALGORITHM& T, 00081 const unsigned int size, 00082 const int p = 1); 00083 00087 const LowerTriangularMatrix<RESULT>& table() const { return table_; } 00088 00089 protected: 00091 LowerTriangularMatrix<RESULT> table_; 00092 }; 00093 00094 } 00095 00096 // include implementation of inline functions 00097 #include <numerics/extrapolation.cpp> 00098 00099 #endif