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

I.hpp

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; }                                  // The Matrix is symmetric
00045 I inverse(){ return *this; }                            // The Matrix is orthogonal
00046 
00047 int size(){ return width*width; }
00048 
00049 int getWidth()const { return width; }
00050 int getHeight()const { return width; }
00051 
00052 // base 0
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 // base 1
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 // Identity transformations
00062 // ---------------------------
00063 RealVector* Ix(RealVector& v, RealVector* dest=0)               // v= I*x
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)            // M= I*A
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)            // M= A*I
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          
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