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

FDiagonalMatrix.hpp

00001 #ifndef __FDiagonalMatrix_H__
00002 #define __FDiagonalMatrix_H__
00003 
00004 
00025 #include <stdio.h>
00026 #include "FloatVector.hpp"
00027 #include "FloatVectorT.hpp"
00028 
00029 #include "AFSymMatrix.hpp"
00030 
00031 class FDiagonalMatrix : public AFSymMatrix
00032 {
00033 private:
00034         
00035 int                             N;
00036 FloatVector*            d;                                      // N size diagonal
00037 
00038 public:
00039         
00040 FDiagonalMatrix(int asize, float val=0.0);
00041 FDiagonalMatrix(const FDiagonalMatrix& v);
00042 FDiagonalMatrix operator=(const FDiagonalMatrix& v);
00043 
00044 virtual ~FDiagonalMatrix(){ delete d;}
00045 
00046 virtual AFloatMatrix* copy(){return new FDiagonalMatrix(*this);}
00047 virtual AFloatMatrix* t(AFloatMatrix* result=0){return copy();}
00048 
00049 virtual FloatVector* solve(FloatVector* b, FloatVector* x=0);
00050 virtual AFSymMatrix* invert();
00051 
00052 void load(FDiagonalMatrix* m);
00053 void load(FloatVector* d1);
00054 
00055 virtual int size()const { return (N); }
00056 
00057 FloatVector* getDvalues(){ return d; }
00058 
00059 // base 0
00060 virtual void set0(int i, int j, float value);
00061 virtual float get0(int i, int j);
00062 
00063 inline void setD0(int i, float value){ d->set0(i, value); }
00064 inline float getD0(int i) const{ return d->get0(i); }
00065 
00066 // base 1
00067 virtual void set(int i, int j, float value);
00068 virtual float get(int i, int j) ;
00069 
00070 inline void setD(int i, float value){ d->set(i, value); }
00071 inline float getD(int i) const{ return d->get(i); }
00072 
00073 // computations
00074 
00075 virtual void setAll(float value=0.0){ d->setAll(value); }
00076 
00077 virtual float det();
00078 virtual float trace();
00079 
00080 virtual float norme2();
00081 virtual float sum();
00082 
00083 virtual float minimum();
00084 virtual float maximum();
00085 virtual float sigma();
00086 
00087 // scalar single operations
00088 void operator*=(float value);
00089 void operator/=(float value);
00090 
00091 virtual void add(float value){}
00092 virtual void subst(float value){}
00093 virtual void mult(float value);
00094 virtual void div(float value);
00095 
00096 // vector single operations
00097 void operator+=(const FDiagonalMatrix& m);
00098 void operator-=(const FDiagonalMatrix& m);
00099 
00100 virtual void add(AFloatMatrix& m){}
00101 virtual void subst(AFloatMatrix& m){}
00102 
00103 // u= A*v including implicit transposition
00104 FloatVector* mult_Av(FloatVector* v, FloatVector* result=0);
00105 FloatVector* mult_ATv(FloatVector* v, FloatVector* result=0){ return mult_Av(v, result); }
00106 // u= v*A
00107 FloatVector* mult_vA(FloatVector* v, FloatVector* result=0)     { return mult_Av(v, result); }
00108 FloatVector* mult_vAT(FloatVector* vt, FloatVector* result=0){ return mult_Av(vt, result); }
00109 
00110 // sub vector usage
00111 // u= A*v
00112 FloatVector* mult_Av(FloatVector* v, int col0, int row0, bool incremental=false, FloatVector* result=0);
00113 FloatVector* mult_ATv(FloatVector* v, int col0, int row0, bool incremental=false, FloatVector* result=0)
00114                         { return mult_Av(v, col0, row0, incremental, result); }
00115 // u= v*A
00116 FloatVector* mult_vA(FloatVector* v, int row0, int col0, bool incremental=false, FloatVector* result=0)
00117                         { return mult_Av(v, col0, row0, incremental, result); }
00118 FloatVector* mult_vAT(FloatVector* vt, int row0, int col0, bool incremental=false, FloatVector* result=0)
00119                         { return mult_Av(vt, col0, row0, incremental, result); }
00120 
00121 // friends
00122 friend FloatVectorT operator*(const FloatVectorT& vt, const FDiagonalMatrix& m);        
00123 friend FloatVector operator*(const FDiagonalMatrix& m, const FloatVector& v);   
00124 
00125 virtual void output();
00126 virtual void output(FILE* file);
00127 };
00128 
00129 #endif
00130 
00131 
00132          
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