00001 #ifndef __FSepSSOR_H__ 00002 #define __FSepSSOR_H__ 00003 00036 #include <stdio.h> 00037 #include "FloatVector.hpp" 00038 00039 #include "AFProductSeqSMatrix.hpp" 00040 00041 #include "FDiagonalMatrix.hpp" 00042 00043 class FloatSMatrix; 00044 00045 00046 // P= L * D * U 00047 class FSepSSOR : public AFProductSeqSMatrix 00048 { 00049 protected: 00050 00051 AFSymMatrix* origin; // used to decide to build a compact type 00052 00053 int ntrial; 00054 double omega; 00055 00056 AFSymMatrix* L; 00057 FDiagonalMatrix* D; 00058 AFSymMatrix* U; 00059 00060 protected: 00061 00062 double evaluateOptimalOmega(AFSymMatrix* A, int trials=3); 00063 00064 public: 00065 FSepSSOR(AFSymMatrix* A); 00066 FSepSSOR(AFSymMatrix* A, double aomega); 00067 FSepSSOR(FSepSSOR& m); 00068 virtual ~FSepSSOR(){delete L; delete D; delete U;} 00069 00070 virtual AFloatMatrix* copy(){ return new FSepSSOR(*this); } 00071 00072 virtual AFSymMatrix* getSubMatrix(int i); 00073 virtual void setSubMatrix(int i, AFSymMatrix* Bi); 00074 00075 virtual FloatVector* solve(FloatVector* b, FloatVector* x=0); // P*x=b 00076 virtual AFSymMatrix* invert(); // P^-1 00077 virtual AFSymMatrix* compact(); // L*D*U --> A 00078 00079 virtual void output(); 00080 virtual void output(FILE* file){} 00081 }; 00082 00083 #endif 00084 00085 00086 00087 00088