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

BFloatSMatrix.hpp

00001 #ifndef __BFloatSMatrix_H__
00002 #define __BFloatSMatrix_H__
00003 
00004 
00005 
00027 #include <stdio.h>
00028 #include "AFSymMatrix.hpp"
00029 
00030 class BFloatSMatrix
00031 {
00032 private:
00033 
00034 int                             width;                  // n blocks
00035 
00036 int                             totalWidth;                     // n values
00037 int                             widthSubMatrix;         // n value in sub matrix
00038 
00039 AFSymMatrix**           p1;
00040 AFSymMatrix***          data;                           // sub matrices
00041 
00042 public:
00043         
00044 BFloatSMatrix(int n, int nsub);                 // Empty block Matrix    ///
00045 BFloatSMatrix(int n, int nsub, float value);            
00046 BFloatSMatrix(int n, AFSymMatrix& m);
00047 BFloatSMatrix(const BFloatSMatrix& bm);                 
00048 BFloatSMatrix operator=(const BFloatSMatrix& bm);       
00049 
00050 ~BFloatSMatrix();                                                       
00051 
00052 BFloatSMatrix* copy();
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 width; }
00064 int getBlockHeight(){ return width; }
00065 int size(){ return width*width; }
00066 
00067 // On items
00068 // base 0
00069 void setBlock0(int i, int j, AFSymMatrix* value){ data[i][j]= value; }
00070 AFSymMatrix* getBlock0(int i, int j){ return data[i][j]; }
00071 
00072 // base 1
00073 void setBlock(int i, int j, AFSymMatrix* value){ data[i-1][j-1]= value; }
00074 AFSymMatrix* getBlock(int i, int j){ return data[i-1][j-1]; }
00075 
00076 // On values
00077 // base 0
00078 void set0(int i, int j, float value)
00079         { 
00080         int ix= i/widthSubMatrix; 
00081         int iy= j/widthSubMatrix;
00082         data[ix][iy]->set0(i%widthSubMatrix, j%widthSubMatrix, value); 
00083         }
00084 float get0(int i, int j)
00085         { 
00086         int ix= i/widthSubMatrix; 
00087         int iy= j/widthSubMatrix;
00088         return data[ix][iy]->get0(i%widthSubMatrix, j%widthSubMatrix); }
00089 
00090 // base 1
00091 void set(int i, int j, float value)     
00092         { 
00093         int ix= (i-1)/widthSubMatrix; 
00094         int iy= (j-1)/widthSubMatrix;
00095         if( data[ix][iy] != 0 )
00096                 data[ix][iy]->set0((i-1)%widthSubMatrix, (j-1)%widthSubMatrix, value); 
00097         }
00098 float get(int i, int j) 
00099         { 
00100         int ix= (i-1)/widthSubMatrix; 
00101         int iy= (j-1)/widthSubMatrix;
00102         if( data[ix][iy] == 0 ) return 0.0;
00103         return data[ix][iy]->get0((i-1)%widthSubMatrix, (j-1)%widthSubMatrix); 
00104         }
00105 
00106 // computations
00107 void setAll(float value=0.0);
00108 void setAll(AFSymMatrix& m);
00109 
00110 float det();
00111 float trace();
00112 
00113 float norme2();
00114 float sum();                                    
00115 
00116 float minimum();                                        
00117 float maximum();
00118 float mean(){ return sum()/size(); }    
00119 float sigma(){return 0.0;}                                      
00120         
00121 
00122 // scalar single operations
00123 void operator+=(float value);
00124 void operator-=(float value);
00125 void operator*=(float value);
00126 void operator/=(float value);
00127 
00128 // u= A*v including implicit transposition
00129 FloatVector* mult_Av(FloatVector* v, FloatVector* result=0);
00130 FloatVector* mult_ATv(FloatVector* v, FloatVector* result=0);
00131 // u= v*A
00132 FloatVector* mult_vA(FloatVector* v, FloatVector* result=0)     { return mult_ATv(v, result); }
00133 FloatVector* mult_vAT(FloatVector* vt, FloatVector* result=0){ return mult_Av(vt, result); }
00134 
00135 // sub vector usage
00136 // u= A*v
00137 FloatVector* mult_Av(FloatVector* v, int col0, int row0, FloatVector* result=0);
00138 FloatVector* mult_ATv(FloatVector* v, int col0, int row0, FloatVector* result=0);
00139 // u= v*A
00140 FloatVector* mult_vA(FloatVector* v, int col0, int row0, FloatVector* result=0)
00141                         { return mult_ATv(v, row0, col0, result); }
00142 FloatVector* mult_vAT(FloatVector* vt, int col0, int row0, FloatVector* result=0)
00143                         { return mult_Av(vt, row0, col0, result); }
00144 
00145 void output();
00146 void output(FILE* file);
00147 };
00148 
00149 #endif
00150 
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