00001 #ifndef __I_I__
00002 #define __I_I__
00003
00004
00005
00024 #include <stdio.h>
00025 #include <string.h>
00026 #include "RealVector.hpp"
00027 #include "RealSMatrix.hpp"
00028
00029 class I
00030 {
00031 private:
00032
00033 int width;
00034
00035 public:
00036
00037 I(int n){width=n;}
00038 I(const I& m){width= m.width;}
00039 I operator=(const I& m){ if(this!=NULL)width= m.width; return *this; }
00040 ~I(){}
00041
00042 I* copy(){ return new I(*this); }
00043
00044 I t(){ return *this; }
00045 I inverse(){ return *this; }
00046
00047 int size(){ return width*width; }
00048
00049 int getWidth()const { return width; }
00050 int getHeight()const { return width; }
00051
00052
00053 void set0(int i, int j, double value){}
00054 double get0(int i, int j)const { return (i==j ? 1.0 : 0.0); }
00055
00056
00057 void set(int i, int j, double value){}
00058 double get(int i, int j)const { return (i==j ? 1.0 : 0.0); }
00059
00060
00061
00062
00063 RealVector* Ix(RealVector& v, RealVector* dest=0)
00064 {
00065 if( dest == 0 ) dest= v.copy();
00066 else *dest= v;
00067 return dest;
00068 }
00069
00070 double* Ix(double* v, double* dest=0)
00071 {
00072 if( dest == 0 ) dest= new double[width];
00073 memcpy(dest, v, width*sizeof(double));
00074 return dest;
00075 }
00076
00077 RealSMatrix* IA(RealSMatrix& A, RealSMatrix* dest=0)
00078 {
00079 if( dest == 0 ) dest= A.copy();
00080 else *dest= A;
00081 return dest;
00082 }
00083
00084
00085 RealSMatrix* AI(RealSMatrix& A, RealSMatrix* dest=0)
00086 {
00087 if( dest == 0 ) dest= A.copy();
00088 else *dest= A;
00089 return dest;
00090 }
00091
00092 void output(){printf("I(%d)\n", width); RealSMatrix ident(*this); ident.output();}
00093 void output(FILE* file){fprintf(file, "I(%d)\n", width); RealSMatrix ident(*this); ident.output(file);}
00094 };
00095
00096 #endif
00097
00098