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; }
00066 H inverse(){ return *this; }
00067
00068 double computeHx(RealVector& x, bool xUpdate=false);
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(); }
00076
00077
00078 void setU0(int i, double value){ u.set0(i, value); }
00079 double getU0(int i)const { return u.get0(i); }
00080
00081
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
00089
00090 RealVector* Hx(RealVector& v, RealVector* dest=0);
00091 double* Hx(double* v, double* dest=0);
00092
00093 RealSMatrix* HA(RealSMatrix& A, RealSMatrix* dest=0);
00094 RealSMatrix* AH(RealSMatrix& A, RealSMatrix* dest=0);
00095
00096
00097
00098 friend RealVector operator*(H& h, RealVector& v);
00099 friend RealSMatrix operator*(RealSMatrix& m, H& h);
00100 friend RealSMatrix operator*(H& h, RealSMatrix& m);
00101
00102 void output();
00103 void output(FILE* file);
00104 };
00105
00106 #endif
00107
00108