Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

AbsFTriDiagonalLS.hpp

00001 #ifndef __AbsFTriDiagonalLS_H__
00002 #define __AbsFTriDiagonalLS_H__
00003 
00004 
00029 #include <stdio.h>
00030 #include "FTriDiagonalMatrix.hpp"
00031 #include "FloatVector.hpp"
00032 
00033 class AbsFTriDiagonalLS
00034 {
00035 protected:
00036         
00037 int                                             N;
00038 
00039 FTriDiagonalMatrix*             A;
00040 FloatVector*                    x;                                      
00041  
00042 FloatVector*                    b;                                       
00043 
00044 public:
00045         
00046 AbsFTriDiagonalLS(int asize)
00047         {
00048         N=asize;
00049         
00050         x= new FloatVector(N);
00051         b= new FloatVector(N);
00052 
00053         A= new FTriDiagonalMatrix(N);
00054         }
00055 
00056 virtual ~AbsFTriDiagonalLS(){ delete A; delete x; delete b;}
00057 
00058 virtual void loadA(FTriDiagonalMatrix* m){ A->load(m); }
00059 virtual void loadMatrix(FloatVector* u1, FloatVector* d1, FloatVector* l1){ A->load(u1,d1,l1); }
00060 virtual void loadX(FloatVector* data){ x->load(data); }
00061 virtual void loadB(FloatVector* data){ b->load(data); }
00062 
00063 virtual int size(){ return (3*N-2); }
00064 
00065 virtual int getWidth(){ return N; }
00066 virtual int getHeight(){ return N; }
00067 
00068 virtual FloatVector* getX(){ return x; }
00069 virtual FloatVector* getB(){ return b; }
00070 
00071 virtual FTriDiagonalMatrix* getA(){ return A; }
00072 
00073 virtual bool solve()=0;                                                         // SOLVING to define later
00074 
00075 virtual bool solve(FloatVector* aX, FloatVector* aB)    // A not changed
00076         {
00077         loadX(aX);
00078         loadB(aB);
00079 
00080         return solve();
00081         }
00082 
00083 virtual bool solve(FTriDiagonalMatrix*  aA, FloatVector* aX, FloatVector* aB)   // new system
00084         {
00085         loadA(aA);
00086 
00087         loadX(aX);
00088         loadB(aB);
00089 
00090         return solve();
00091         }
00092         
00093 
00094 virtual FloatVector* evaluate(FloatVector* aX, FloatVector* aB)
00095         {
00096         solve(aX, aB);
00097 
00098         return getX();
00099         }
00100 
00101 virtual FloatVector* evaluate(FTriDiagonalMatrix* aA, FloatVector* aX, FloatVector* aB)
00102         {
00103         solve(aA, aX, aB);
00104 
00105         return getX();
00106         }
00107         
00108 virtual void output()
00109         {
00110         printf("Linear System\n");
00111         A->output();
00112         printf("x: "); x->output();
00113         printf("b: "); b->output();
00114         }
00115 
00116 virtual void output(FILE* file)
00117         {
00118         fprintf(file, "Linear System\n");
00119         A->output(file);
00120         fprintf(file, "x: "); x->output(file);
00121         fprintf(file, "b: "); b->output(file);
00122         }
00123 };
00124 
00125 #endif
00126 
00127 
00128          
SourceForge.net Logo
Restoreinpaint sourceforge project `C++/Java Image Processing, Restoration, Inpainting Project'.

Bernard De Cuyper: Open Project Leader: Concept, design and development.
Bernard De Cuyper & Eddy Fraiha 2002, 2003. Bernard De Cuyper 2004. Open and free, for friendly usage only.
Modifications on Belgium ground of this piece of artistic work, by governement institutions or companies, must be notified to Bernard De Cuyper.
bern_bdc@hotmail.com