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

RealBlockSMatrix.hpp

00001 #ifndef __RealBlockSMatrix_H__
00002 #define __RealBlockSMatrix_H__
00003 
00004 
00005 
00040 #include <stdio.h>
00041 #include "RealSMatrix.hpp"
00042 
00043 class RealBlockSMatrix
00044 {
00045 private:
00046 
00047 int                             width;
00048 
00049 int                             n;
00050 int                             localWidth;
00051 RealSMatrix**           data;
00052 
00053 public:
00054         
00055 RealBlockSMatrix(int n, int lwidth);
00056 RealBlockSMatrix(int n, const RealSMatrix& m);
00057 RealBlockSMatrix(const RealBlockSMatrix& m);
00058 RealBlockSMatrix operator=(const RealBlockSMatrix& m);
00059 
00060 ~RealBlockSMatrix();
00061 
00062 RealBlockSMatrix* copy();
00063 
00064 RealBlockSMatrix* AtA(RealBlockSMatrix* dest=0);
00065 
00066 RealBlockSMatrix t();
00067 
00068 int numberOItems(){ return n*n; }
00069 int getXitems(){ return n; }
00070 int getYitems(){ return n; }
00071 
00072 int getItemWidth()const { return localWidth; }
00073 int getItemHeight()const { return localWidth; }
00074 
00075 int size(){ return width*width; }
00076 
00077 int getWidth()const { return width; }
00078 int getHeight()const { return width; }
00079 
00080 // item base 0
00081 void set0(int i, int j, RealSMatrix* value){ data[i][j]= value; }
00082 RealSMatrix* get0(int i, int j)const { return data[i][j]; }
00083 
00084 // item base 1
00085 void set(int i, int j, RealSMatrix* value){ data[i-1][j-1]= value; }
00086 RealSMatrix* get(int i, int j)const { return data[i-1][j-1]; }
00087 
00088 
00089 // base 0
00090 void set0(int i, int j, double value);
00091 double get0(int i, int j)const;
00092 
00093 // base 1
00094 void set(int i, int j, double value);
00095 double get(int i, int j)const;
00096 
00097 // computations
00098 void setAll(double value=0.0);
00099 void set(RealBlockSMatrix* from);
00100 
00101 // optimized transform (reduced cons)
00102 RealBlockSMatrix* multA_X(RealBlockSMatrix* dest);                                      // X <-- A*X
00103  
00104 void addA_kX(RealBlockSMatrix& dest, double k=1.0);                             // A <-- A+k*X 
00105 void addA_k_vvT(RealVector& v, double k=1.0);                           // A <-- A+k*(v*vT) 
00106 double vTAv(RealVector& v);                                                     // quadratic form: vT*A*v 
00107 double rayleighQuotient(RealVector& v){return vTAv(v)/v.vT_v();}        // r= vT*A*v/(vT*v) approximates an eigenvalue 
00108 
00109 double det();
00110 double trace();
00111 double cond();
00112 
00113 // norm
00114 double normeMin();
00115 double normeInfinite();
00116 double norme2();                        // spectral norme= sqrt( max eigenvalue )
00117 double normeF();                        // frobenius norme      
00118 
00119 double sum();
00120 
00121 double minimum();
00122 double maximum();
00123 double mean(){ return sum()/size(); }
00124 double sigma();
00125 
00126 // matrix generation
00127 RealBlockSMatrix* jacobiEV(RealVector* dEigenValue, RealBlockSMatrix* vEigenVector); // Numerical Recipes p365-6
00128 
00129 // math vectorial op
00130 RealBlockSMatrix sqrt();
00131 RealBlockSMatrix pow(double pow);
00132 RealBlockSMatrix sqr();
00133 RealBlockSMatrix exp();
00134 RealBlockSMatrix log();
00135 RealBlockSMatrix log(double base);
00136 
00137 RealBlockSMatrix sin();
00138 RealBlockSMatrix cos();
00139 RealBlockSMatrix tan(); 
00140 
00141 // matrix operations
00142 // =================
00143 
00144 // scalar single operations
00145 void operator+=(double value);
00146 void operator-=(double value);
00147 void operator*=(double value);
00148 void operator/=(double value);
00149 
00150 // matrix single operations
00151 void operator+=(const RealBlockSMatrix& m);
00152 void operator-=(const RealBlockSMatrix& m);
00153 void operator*=(const RealBlockSMatrix& m);
00154 
00155 // friends
00156 friend RealVectorT operator*(const RealVectorT& vt, const RealBlockSMatrix& m); 
00157 friend RealVector operator*(const RealBlockSMatrix& m, const RealVector& v);    
00158         
00159 void output();
00160 void output(FILE* file);
00161 };
00162 
00163 #endif
00164 
00165          
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