00001 #ifndef __G_H__ 00002 #define __G_H__ 00003 00004 00005 00040 #include <stdio.h> 00041 #include "RealVector.hpp" 00042 00043 class RealSMatrix; 00044 00045 class G 00046 { 00047 public: 00048 00049 double c; 00050 double s; 00051 00052 int i; 00053 int j; 00054 00055 public: 00056 00057 G(double x1, double x2); 00058 G(RealSMatrix& m, int i, int j); 00059 G(const G& m); 00060 G operator=(const G& m); 00061 ~G(){} 00062 00063 G* copy(){ return new G(*this); } 00064 00065 G t(){ return *this; } // The Matrix is symmetric 00066 G inverse(){ return *this; } // The Matrix is orthogonal 00067 00068 double computeGx(RealVector& x, int i, int j, bool xUpdate=false); // computed u,sigma via x 00069 double computeGx(double* x, int i, int j); 00070 double computeGx(double x1, double x2); 00071 00072 int size(){ return width*width; } 00073 int getWidth()const { return width; } 00074 int getHeight()const { return width; } 00075 00076 double getCos(){ return c; } 00077 double getSin(){ return s; } 00078 double getTheta(){ return atan(s/c); } 00079 00080 // Givens transformations 00081 // --------------------------- 00082 RealVector* Gx(RealVector& v, int i, int j, RealVector* dest=0); // v= G*x 00083 double* Gx(double* v, int i, int j, double* dest=0); 00084 00085 RealSMatrix* GA(RealSMatrix& A, int i, int j, RealSMatrix* dest=0); // M= Gt*A 00086 RealSMatrix* AG(RealSMatrix& A, int i, int j, RealSMatrix* dest=0); // M= A*G 00087 00088 00089 // friends 00090 friend RealVector operator*(G& g, RealVector& v); // v= G*x 00091 friend RealSMatrix operator*(RealSMatrix& m, G& g); // M= G*A 00092 friend RealSMatrix operator*(G& g, RealSMatrix& m); // M= A*G 00093 00094 void output(); 00095 void output(FILE* file); 00096 }; 00097 00098 #endif 00099 00100