00001 #ifndef __AbsTriDiagIterativeLS_H__
00002 #define __AbsTriDiagIterativeLS_H__
00003 
00004 
00029 #include "AbsTriDiagonalLS.hpp"
00030 #include "RealVector.hpp"
00031 
00032 class   AbsTriDiagIterativeLS : public AbsTriDiagonalLS
00033 {
00034 protected:
00035         
00036 int                     currentIteration;
00037 int                     maxIterations;
00038 double          epsilon;                                         
00039 
00040 public:
00041         
00042 AbsTriDiagIterativeLS(int asize, int iterMax, double eps=1e-4):AbsTriDiagonalLS(asize)
00043         {
00044         currentIteration=0;
00045 
00046         maxIterations= iterMax;
00047         epsilon= eps;
00048         }
00049 
00050 virtual ~AbsTriDiagIterativeLS(){}
00051 
00052 virtual bool iterate()=0;                                       
00053 
00054 virtual bool solve()                                                            
00055         {
00056         currentIteration=0;
00057 
00058         while( iterate() == true && currentIteration < maxIterations) 
00059                 { 
00060                 currentIteration++; 
00061                 }
00062 
00063         return true;
00064         }
00065 
00066 virtual void output()
00067         {
00068         printf("Iterative Linear System\n");
00069         A->output();
00070         printf("x: "); x->output();
00071         printf("b: "); b->output();
00072         }
00073 
00074 virtual void output(FILE* file)
00075         {
00076         fprintf(file, "Iterative Linear System\n");
00077         A->output(file);
00078         fprintf(file, "x: "); x->output(file);
00079         fprintf(file, "b: "); b->output(file);
00080         }
00081 };
00082 
00083 #endif
00084