00001 #ifndef __CG_H__ 00002 #define __CG_H__ 00003 00004 00027 #include "AbsTriDiagIterativeLS.hpp" 00028 00029 class CG : public AbsTriDiagIterativeLS 00030 { 00031 protected: 00032 00033 double alpha; 00034 double beta; 00035 00036 RealVector* r; 00037 RealVector* p; 00038 00039 RealVector* ap; 00040 00041 00042 public: 00043 00044 CG(int asize, int iterMax, double eps=1e-4):AbsTriDiagIterativeLS(asize, iterMax, eps) 00045 { 00046 r= new RealVector(N); 00047 p= new RealVector(N); 00048 ap= new RealVector(N); 00049 } 00050 00051 virtual ~CG(){delete r; delete p; delete ap;} 00052 00053 virtual bool iterate(); // SOLVING to define 00054 00055 00056 virtual void output() 00057 { 00058 printf("CG "); 00059 AbsTriDiagIterativeLS::output(); 00060 } 00061 00062 virtual void output(FILE* file) 00063 { 00064 fprintf(file, "CG "); 00065 AbsTriDiagIterativeLS::output(file); 00066 } 00067 }; 00068 00069 #endif 00070