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

CTriDiagonalMatrix.hpp

00001 #ifndef __CTriDiagonalMatrix_H__
00002 #define __CTriDiagonalMatrix_H__
00003 
00004 
00005 
00025 #include <stdio.h>
00026 #include "RComplex.hpp"
00027 #include "CVector.hpp"
00028 
00029 class CTriDiagonalMatrix
00030 {
00031 private:
00032         
00033 int                     N;
00034 
00035 CVector*                up;                                     // N-1 size upper diagonal 
00036 CVector*                d;                                      // N size diagonal
00037 CVector*                low;                            // N-1 size lower diagonal 
00038 
00039 public:
00040         
00041 CTriDiagonalMatrix(int asize);
00042 CTriDiagonalMatrix(const CTriDiagonalMatrix& v);
00043 CTriDiagonalMatrix operator=(const CTriDiagonalMatrix& v);
00044 
00045 ~CTriDiagonalMatrix(){ delete d; delete up; delete low;}
00046 
00047 CTriDiagonalMatrix t();
00048 
00049 void load(CTriDiagonalMatrix* m);
00050 void load(CVector* u1, CVector* d1, CVector* l1);
00051 
00052 inline int size()const { return (3*N-2); }
00053 
00054 inline int getWidth()const { return N; }
00055 inline int getHeight()const { return N; }
00056 
00057 CVector* getUvalues(){ return up; }
00058 CVector* getDvalues(){ return d; }
00059 CVector* getLvalues(){ return low; }
00060 
00061 // base 0
00062 void set0(int i, int j, double value);
00063 void set0(int i, int j, const RComplex& value);
00064 RComplex get0(int i, int j)const ;
00065 
00066 inline void setD0(int i, double value){ d->set0(i, value); }
00067 inline void setD0(int i, const RComplex& value){ d->set0(i, value); }
00068 inline RComplex getD0(int i)const { return d->get0(i); }
00069 
00070 inline void setU0(int i, double value){ up->set0(i, value); }
00071 inline void setU0(int i, const RComplex& value){ up->set0(i, value); }
00072 inline RComplex getU0(int i)const { return up->get0(i); }
00073 
00074 inline void setL0(int i, double value){ low->set0(i, value); }
00075 inline void setL0(int i, const RComplex& value){ low->set0(i, value); }
00076 inline RComplex getL0(int i)const { return low->get0(i); }
00077 
00078 // base 1
00079 void set(int i, int j, double value);
00080 void set(int i, int j, const RComplex& value);
00081 RComplex get(int i, int j)const ;
00082 
00083 inline void setD(int i, double value){ d->set(i, value); }
00084 inline void setD(int i, const RComplex& value){ d->set(i, value); }
00085 inline RComplex getD(int i)const { return d->get(i); }
00086 
00087 inline void setU(int i, double value){ up->set(i, value); }
00088 inline void setU(int i, const RComplex& value){ up->set(i, value); }
00089 inline RComplex getU(int i)const { return up->get(i); }
00090 
00091 inline void setL(int i, double value){ low->set(i, value); }
00092 inline void setL(int i, const RComplex& value){ low->set(i, value); }
00093 inline RComplex getL(int i)const { return low->get(i); }
00094 
00095 
00096 // computations
00097 RComplex trace();
00098 
00099 
00100 RComplex norme2();
00101 RComplex sum();
00102 
00103 RComplex mean(){ return sum()/size(); }
00104 RComplex sigma();
00105 
00106 // math vectorial op
00107 CTriDiagonalMatrix sqrt();
00108 CTriDiagonalMatrix sqr();
00109 
00110 
00111 // scalar single operations
00112 void operator+=(double value);
00113 void operator-=(double value);
00114 void operator*=(double value);
00115 void operator/=(double value);
00116 
00117 void operator+=(const RComplex& value);
00118 void operator-=(const RComplex& value);
00119 void operator*=(const RComplex& value);
00120 void operator/=(const RComplex& value);
00121 
00122 // vector single operations
00123 void operator+=(const CTriDiagonalMatrix& m);
00124 void operator-=(const CTriDiagonalMatrix& m);
00125 
00126 // friends
00127 friend CVectorT operator*(const CVectorT& vt, const CTriDiagonalMatrix& m);     
00128 friend CVector operator*(const CTriDiagonalMatrix& m, const CVector& v);                
00129         
00130 void output();
00131 void output(FILE* file);
00132 };
00133 
00134 #endif
00135 
00136          
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