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

FloatSMatrix.hpp

00001 #ifndef __FloatSMatrix_H__
00002 #define __FloatSMatrix_H__
00003 
00004 
00005 
00024 #include <stdio.h>
00025 #include "FloatVector.hpp"
00026 
00027 #include "AFSymMatrix.hpp"
00028 
00029 
00030 class FloatSMatrix : public AFSymMatrix
00031 {
00032 private:
00033 
00034 float**         data;
00035 
00036 public:
00037         
00038 FloatSMatrix(int n, float value=0.0);
00039 FloatSMatrix(const FloatSMatrix& m);
00040 FloatSMatrix operator=(const FloatSMatrix& m);
00041 
00042 virtual ~FloatSMatrix();
00043 
00044 virtual AFSymMatrix* copyAnn();
00045 virtual AFloatMatrix* copy();
00046 virtual AFloatMatrix* t(AFloatMatrix* result=0);
00047 
00048 // base 0
00049 virtual void set0(int i, int j, float value){ data[i][j]= value; }
00050 virtual float get0(int i, int j){ return data[i][j]; }
00051 
00052 // base 1
00053 virtual void set(int i, int j, float value){ data[i-1][j-1]= value; }
00054 virtual float get(int i, int j){ return data[i-1][j-1]; }
00055 
00056 // computations
00057 virtual void setAll(float value=0.0);
00058 
00059 virtual float det();
00060 virtual float trace();
00061 
00062 virtual float norme2();
00063 virtual float normeF();         // Frobenuis norme= trace(At*A)
00064 virtual float norme1();
00065 virtual float normeInf();
00066 
00067 virtual float sum();
00068 virtual float sum2();
00069 
00070 virtual float minimum();
00071 virtual float maximum();
00072 virtual float sigma();
00073 
00074 // math vectorial op
00075 FloatSMatrix sqrt();
00076 FloatSMatrix pow(float pow);
00077 FloatSMatrix sqr();
00078 FloatSMatrix exp();
00079 FloatSMatrix log();
00080 FloatSMatrix log(float base);
00081 
00082 FloatSMatrix sin();
00083 FloatSMatrix cos();
00084 FloatSMatrix tan();     
00085 
00086 // scalar single operations
00087 void operator+=(float value);
00088 void operator-=(float value);
00089 void operator*=(float value);
00090 void operator/=(float value);
00091 
00092 virtual void add(float value);
00093 virtual void subst(float value);
00094 virtual void mult(float value);
00095 virtual void div(float value);
00096 
00097 // vector single operations
00098 void operator+=(FloatSMatrix& m);
00099 void operator-=(FloatSMatrix& m);
00100 
00101 virtual void add(AFloatMatrix& m);
00102 virtual void subst(AFloatMatrix& m);
00103 
00104 // Krylov Spaces
00105 FloatVector** arnoldi(FloatSMatrix* h); // H(n-1,n-1)
00106 
00107 // u= A*v including implicit transposition
00108 virtual FloatVector* mult_Av(FloatVector* v, FloatVector* result=0);
00109 virtual FloatVector* mult_ATv(FloatVector* v, FloatVector* result=0);
00110 // u= v*A
00111 virtual FloatVector* mult_vA(FloatVector* v, FloatVector* result=0)     { return mult_ATv(v, result); }
00112 virtual FloatVector* mult_vAT(FloatVector* vt, FloatVector* result=0){ return mult_Av(vt, result); }
00113 
00114 // sub vector usage
00115 // u= A*v
00116 FloatVector* mult_Av(FloatVector* v, int col0, int row0, bool incremental=false, FloatVector* result=0);
00117 FloatVector* mult_ATv(FloatVector* v, int col0, int row0, bool incremental=false, FloatVector* result=0);
00118 // u= v*A
00119 FloatVector* mult_vA(FloatVector* v, int row0, int col0, bool incremental=false, FloatVector* result=0)
00120                         { return mult_ATv(v, col0, row0, incremental, result); }
00121 FloatVector* mult_vAT(FloatVector* vt, int row0, int col0, bool incremental=false, FloatVector* result=0)
00122                         { return mult_Av(vt, col0, row0, incremental, result); }
00123 
00124 // condition number Estimation
00125 float cond1();                          // to verify, may need more accuracy
00126 
00127 // direct inversion U, L
00128 AFloatMatrix* inverseOfU0(AFloatMatrix* uinv=0);                // Uinv = U^-1
00129 AFloatMatrix* inverseOfU1(AFloatMatrix* uinv=0);        // U1inv = U1^-1
00130 
00131 // incomplete factorisation
00132 virtual AFloatMatrix* ilu0();
00133 virtual AFloatMatrix* milu0();
00134 virtual AFloatMatrix* rilu0(float omega=0.95);
00135 virtual AFloatMatrix* iluth(double threshold=0.001);
00136 virtual AFloatMatrix* ilut(int p, double eps=0.001);            // Threshold is related to magitude in row
00137 virtual AFloatMatrix* icf();
00138 virtual AFloatMatrix* ildlt();
00139 
00140 // approximate inversion
00141 virtual AFloatMatrix* apinv(int iterOuter, int iterInner);              // column based iterative inversion
00142 
00143 // friends
00144 friend FloatVectorT operator*(FloatVectorT& vt, FloatSMatrix& m);       
00145 friend FloatVector operator*(FloatSMatrix& m, FloatVector& v);  
00146 
00147 virtual void output(){ printf("Full "); AFSymMatrix::output(); }
00148 };
00149 
00150 #endif
00151 
00152 
00153          
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