MathTL
numerics/iteratsolv.h
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_ITERATSOLV_H
00011 #define _MATHTL_ITERATSOLV_H
00012 
00013 // A collection of template-based iterative solvers for linear systems.
00014 // 
00015 // VECTOR: arbitrary vector class, should implement the operators +, -, * (scalar mult.)
00016 // MATRIX: matrix class
00017 // PREC:   preconditioner, we require apply_preconditioner(const VECTOR&, VECTOR&)
00018 
00019 namespace FLAT
00020 {
00021   // NOTE: the following routines access matrices and vectors with unsigned integer
00022   // indices from 0 to size()-1 !!!
00023 
00024   // Stationary iterative schemes (Richardson, Jacobi, Gauss-Seidel, SOR, SSOR)
00025   //   x^{(k+1)} = Bx^{(k)} + c
00026 
00028 
00038   template <class VECTOR, class MATRIX>
00039   void Richardson(const MATRIX &A, const VECTOR &b, VECTOR &xk, const double omega,
00040                   const double tol, const unsigned int maxiter, unsigned int& iterations);
00041 
00043 
00052   template <class VECTOR, class MATRIX>
00053   void Jacobi(const MATRIX &A, const VECTOR &b, VECTOR &xk,
00054               const double tol, const unsigned int maxiter, unsigned int& iterations);
00055 
00057 
00066   template <class VECTOR, class MATRIX>
00067   void GaussSeidel(const MATRIX &A, const VECTOR &b, VECTOR &xk,
00068                    const double tol, const unsigned int maxiter, unsigned int& iterations);
00069 
00071 
00080   template <class VECTOR, class MATRIX>
00081   void SOR(const MATRIX &A, const VECTOR &b, VECTOR &xk, const double omega,
00082            const double tol, const unsigned int maxiter, unsigned int& iterations);
00083   
00085 
00094   template <class VECTOR, class MATRIX>
00095   void SSOR(const MATRIX &A, const VECTOR &b, VECTOR &xk, const double omega,
00096            const double tol, const unsigned int maxiter, unsigned int& iterations);
00097  
00099 
00108   template <class VECTOR, class MATRIX>
00109   bool CG(const MATRIX &A, const VECTOR &b, VECTOR &xk,
00110           const double tol, const unsigned int maxiter, unsigned int& iterations);
00111 
00113 
00123   template <class VECTOR, class MATRIX, class PREC>
00124   bool PCG(const MATRIX &A, const VECTOR &b, const PREC& P, VECTOR &xk,
00125            const double tol, const unsigned int maxiter, unsigned int& iterations);
00126 }
00127 
00128 #include <numerics/iteratsolv.cpp>
00129 
00130 #endif
 All Classes Functions Variables Typedefs Enumerations