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

H.hpp

00001 #ifndef __H_H__
00002 #define __H_H__
00003 
00004 
00005 
00040 #include <stdio.h>
00041 #include "RealVector.hpp"
00042 
00043 class RealSMatrix;
00044 
00045 class H
00046 {
00047 private:
00048 
00049 int                     width;
00050 RealVector              u;
00051 
00052 double          sigma;
00053 
00054 public:
00055         
00056 H(int n, double value=0.0):u(0.0){width=n; sigma=0.0;}
00057 H(int n, double* x, bool xUpdate=false);
00058 H(RealVector& x, bool xUpdate=false);
00059 H(const H& m);
00060 H operator=(const H& m);
00061 ~H(){}
00062 
00063 H* copy(){ return new H(*this); }
00064 
00065 H t(){ return *this; }                                  // The Matrix is symmetric
00066 H inverse(){ return *this; }                            // The Matrix is orthogonal
00067 
00068 double computeHx(RealVector& x, bool xUpdate=false);            // computed u,sigma via x
00069 double computeHx(double* x);
00070 
00071 int size(){ return width*width; }
00072 int getWidth()const { return width; }
00073 int getHeight()const { return width; }
00074 
00075 double getBeta(){ return 2.0/u.vT_v(); }                // beta= 2/(uT*u)
00076 
00077 // base 0
00078 void setU0(int i, double value){ u.set0(i, value); }
00079 double getU0(int i)const { return u.get0(i); }
00080 
00081 // base 1
00082 void setU(int i, double value){ u.set0(i, value); }
00083 double getU(int i)const { return u.get0(i); }
00084 
00085 double getSigma(){return sigma;}
00086 RealVector& getU(){return u;}
00087 
00088 // Householder transformations
00089 // ---------------------------
00090 RealVector* Hx(RealVector& v, RealVector* dest=0);              // v= H*x
00091 double* Hx(double* v, double* dest=0);
00092 
00093 RealSMatrix* HA(RealSMatrix& A, RealSMatrix* dest=0);           // M= H*A
00094 RealSMatrix* AH(RealSMatrix& A, RealSMatrix* dest=0);           // M= A*H
00095 
00096 
00097 // friends
00098 friend RealVector operator*(H& h, RealVector& v);       // v= H*x 
00099 friend RealSMatrix operator*(RealSMatrix& m, H& h);     // M= H*A
00100 friend RealSMatrix operator*(H& h, RealSMatrix& m);     // M= A*H
00101         
00102 void output();
00103 void output(FILE* file);
00104 };
00105 
00106 #endif
00107 
00108          
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