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

BFTriDiagonalMatrix.hpp

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