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

BFTriDiag3_1.hpp

00001 #ifndef __BFTriDiag3_1_H__
00002 #define __BFTriDiag3_1_H__
00003 
00004 
00025 #include <stdio.h>
00026 #include "FloatVector.hpp"
00027 #include "FTriDiagonalMatrix.hpp"
00028 #include "FDiagonalMatrix.hpp"
00029 
00030 class BFTriDiag3_1
00031 {
00032 private:
00033         
00034 int                             N;                              // number of matrices on the diagonal
00035 
00036 int                             totalWidth;                     // n values
00037 int                             widthSubMatrix;         // n value in sub matrix
00038 
00039 FDiagonalMatrix**               up;                                     // N-1 size upper diagonal 
00040 FTriDiagonalMatrix**    d;                                      // N size diagonal
00041 FDiagonalMatrix**               low;                                    // N-1 size lower diagonal 
00042 
00043 public:
00044         
00045 BFTriDiag3_1(int asize, int nsub);                              // empty
00046 BFTriDiag3_1(int asize, int nsub, float value); 
00047 BFTriDiag3_1(int asize, int nsub, float lval, float dval, float uval);                  
00048 BFTriDiag3_1(const BFTriDiag3_1& v);
00049 BFTriDiag3_1 operator=(const BFTriDiag3_1& v);
00050 
00051 ~BFTriDiag3_1(){ delete d; delete up; delete low;}
00052 
00053 // total values
00054 int getWidth(){ return totalWidth; }
00055 int getHeight(){ return totalWidth; }
00056 
00057 // item size
00058 int getItemWidth(){ return widthSubMatrix; }
00059 int getItemHeight(){ return widthSubMatrix; }
00060 
00061 // number of blocks
00062 int getBlockWidth(){ return N; }
00063 int getBlockHeight(){ return N; }
00064 inline int size()const { return (3*N-2); }
00065 
00066 FDiagonalMatrix** getUblocks(){ return up; }
00067 FTriDiagonalMatrix** getDblocks(){ return d; }
00068 FDiagonalMatrix** getLblocks(){ return low; }
00069 
00070 // base 0
00071 inline void setBlockD0(int i, FTriDiagonalMatrix* value){ d[i]= value; }
00072 inline FTriDiagonalMatrix* getBlockD0(int i)const { return d[i]; }
00073 
00074 inline void setBlockU0(int i, FDiagonalMatrix* value){ up[i]= value; }
00075 inline FDiagonalMatrix* getBlockU0(int i)const { return up[i]; }
00076 
00077 inline void setBlockL0(int i, FDiagonalMatrix* value){ low[i]= value; }
00078 inline FDiagonalMatrix* getBlockL0(int i)const { return low[i]; }
00079 
00080 // base 0
00081 void set0(int i, int j, float value);
00082 float get0(int i, int j)const ;
00083 
00084 inline void setBlockD(int i, FTriDiagonalMatrix* value){ d[i-1]= value; }
00085 inline FTriDiagonalMatrix* getBlockD(int i)const { return d[i-1]; }
00086 
00087 inline void setBlockU(int i, FDiagonalMatrix* value){ up[i-1]= value; }
00088 inline FDiagonalMatrix* getBlockU(int i)const { return up[i-1]; }
00089 
00090 inline void setBlockL(int i, FDiagonalMatrix* value){ low[i-1]= value; }
00091 inline FDiagonalMatrix* getBlockL(int i)const { return low[i-1]; }
00092 
00093 // base 1
00094 void set(int i, int j, float value);
00095 float get(int i, int j)const ;
00096 
00097 // computations
00098 float det();
00099 float trace();
00100 
00101 float sum();
00102 
00103 float minimum();
00104 float maximum();
00105 float mean(){ return sum()/size(); }
00106 
00107 // scalar single operations
00108 void operator+=(float value);
00109 void operator-=(float value);
00110 void operator*=(float value);
00111 void operator/=(float value);
00112 
00113 // u= A*v including implicit transposition
00114 FloatVector* mult_Av(FloatVector* v, FloatVector* result=0);
00115 FloatVector* mult_ATv(FloatVector* v, FloatVector* result=0);
00116 // u= v*A
00117 FloatVector* mult_vA(FloatVector* v, FloatVector* result=0)     { return mult_ATv(v, result); }
00118 FloatVector* mult_vAT(FloatVector* vt, FloatVector* result=0){ return mult_Av(vt, result); }
00119 
00120 // sub vector usage
00121 // u= A*v
00122 FloatVector* mult_Av(FloatVector* v, int col0, int row0, FloatVector* result=0);
00123 FloatVector* mult_ATv(FloatVector* v, int col0, int row0, FloatVector* result=0);
00124 // u= v*A
00125 FloatVector* mult_vA(FloatVector* v, int col0, int row0, FloatVector* result=0)
00126                         { return mult_ATv(v, row0, col0, result); }
00127 FloatVector* mult_vAT(FloatVector* vt, int col0, int row0, FloatVector* result=0)
00128                         { return mult_Av(vt, row0, col0, result); }
00129 
00130 // friends
00131 friend FloatVectorT operator*(const FloatVectorT& vt, const FTriDiagonalMatrix& m);     
00132 friend FloatVector operator*(const FTriDiagonalMatrix& m, const FloatVector& v);
00133 
00134 void output();
00135 void output(FILE* file);                
00136 };
00137 
00138 #endif
00139 
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