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

AbsPentaDiagonalLS.hpp

00001 #ifndef __AbsPentaDiagonalLS_H__
00002 #define __AbsPentaDiagonalLS_H__
00003 
00029 #include <stdio.h>
00030 #include "RPentaDiagonalMatrix.hpp"
00031 #include "RealVector.hpp"
00032 
00033 class AbsPentaDiagonalLS
00034 {
00035 protected:
00036         
00037 int                             order;
00038 int                             N;
00039 
00040 RPentaDiagonalMatrix*   A;
00041 RealVector*                     x;                                      
00042  
00043 RealVector*                     b;                                       
00044 
00045 public:
00046         
00047 AbsPentaDiagonalLS(int asize)
00048         {
00049         order=2;
00050         N=asize;
00051         
00052         x= new RealVector(N);
00053         b= new RealVector(N);
00054 
00055         A= new RPentaDiagonalMatrix(N);
00056         }
00057 
00058 virtual ~AbsPentaDiagonalLS(){ delete A; delete x; delete b;}
00059 
00060 virtual void initFreezing(int val=0){}
00061 virtual void freeze(int item, int val=0){}  // freezing used later for marking identity diagonal only values 
00062 
00063 virtual void loadA(RPentaDiagonalMatrix* m){ A->load(m); }
00064 virtual void loadMatrix(RealVector* u2,RealVector* u1, RealVector* d1, RealVector* l1, RealVector* l2)
00065         { A->load(u2,u1,d1,l1,l2); }
00066 virtual void loadX(RealVector* data){ x->load(data); }
00067 virtual void loadB(RealVector* data){ b->load(data); }
00068 
00069 virtual int size(){ return (5*N-6); }
00070 
00071 virtual int getWidth(){ return N; }
00072 virtual int getHeight(){ return N; }
00073 
00074 virtual RealVector* getX(){ return x; }
00075 virtual RealVector* getB(){ return b; }
00076 
00077 virtual RPentaDiagonalMatrix* getA(){ return A; }
00078 
00079 virtual bool solve()=0;                                                         // SOLVING to define later
00080 
00081 virtual bool solve(RealVector* aX, RealVector* aB)      // A not changed
00082         {
00083         loadX(aX);
00084         loadB(aB);
00085 
00086         return solve();
00087         }
00088 
00089 virtual bool solve(RPentaDiagonalMatrix*        aA, RealVector* aX, RealVector* aB)     // new system
00090         {
00091         loadA(aA);
00092 
00093         loadX(aX);
00094         loadB(aB);
00095 
00096         return solve();
00097         }
00098         
00099 
00100 virtual RealVector* evaluate(RealVector* aX, RealVector* aB)
00101         {
00102         solve(aX, aB);
00103 
00104         return getX();
00105         }
00106 
00107 virtual RealVector* evaluate(RPentaDiagonalMatrix* aA, RealVector* aX, RealVector* aB)
00108         {
00109         solve(aA, aX, aB);
00110 
00111         return getX();
00112         }
00113         
00114 virtual void output()
00115         {
00116         printf("Linear System\n");
00117         A->output();
00118         printf("x: "); x->output();
00119         printf("b: "); b->output();
00120         }
00121 
00122 virtual void output(FILE* file)
00123         {
00124         fprintf(file, "Linear System\n");
00125         A->output(file);
00126         fprintf(file, "x: "); x->output(file);
00127         fprintf(file, "b: "); b->output(file);
00128         }
00129 };
00130 
00131 #endif
00132 
00133  
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