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

CVector.hpp

00001 #ifndef __CVector_H__
00002 #define __CVector_H__
00003 
00004 
00023 #include <stdio.h>
00024 #include "RComplex.hpp"
00025 
00026 class CVectorT;
00027 
00028 class CVector
00029 {
00030 private:
00031         
00032 int             dataSize;
00033 RComplex*       data;                   // base 0
00034 
00035 RComplex*  data1;
00036 
00037 public:
00038         
00039 CVector(int size);
00040 CVector(int size, const RComplex& adata);
00041 CVector(const CVector& v);
00042 CVector operator=(const CVector& v);
00043 
00044 ~CVector(){ data=0; delete[] data1; }
00045 
00046 CVectorT t();
00047 
00048 CVector* sub(int start, int step, int end);
00049 
00050 inline int size()const { return dataSize; }
00051 
00052 void load(CVector* v);
00053 RComplex* getData(){return data;}
00054 
00055 // base 0
00056 inline void set0(int index, double value){ data[index]= RComplex(value); }
00057 inline void set0(int index, const RComplex& value){ data[index]= value; }
00058 inline RComplex get0(int index)const { return data[index]; }
00059 
00060 // base 1
00061 inline void set(int index, double value){ data1[index]= RComplex(value); }
00062 inline void set(int index, const RComplex& value){ data1[index]= value; }
00063 inline RComplex get(int index)const { return data1[index]; }
00064 
00065 
00066 void setAll(double value);
00067 void setAll(const RComplex& value);
00068 
00069 // computations
00070 RComplex vT_v();
00071 RComplex norme2();
00072 RComplex sum();
00073 
00074 RComplex mean(){ return sum()/dataSize; }
00075 RComplex sigma();
00076 
00077 // math vectorial op
00078 CVector sqrt();
00079 CVector sqr();
00080 
00081 
00082 // scalar single operations
00083 void operator+=(double value);
00084 void operator-=(double value);
00085 void operator*=(double value);
00086 void operator/=(double value);
00087 
00088 void operator+=(const RComplex& value);
00089 void operator-=(const RComplex& value);
00090 void operator*=(const RComplex& value);
00091 void operator/=(const RComplex& value);
00092 
00093 // vector single operations
00094 void operator+=(const CVector& v);
00095 void operator-=(const CVector& v);
00096 void operator*=(const CVector& v);
00097 void operator/=(const CVector& v);
00098 
00099 // friends
00100 friend RComplex operator*(const CVectorT& vt,const  CVector& u);                        // scalar product
00101 
00102 friend CVector operator+(const CVector& v, double a);                   // v<op>a
00103 friend CVector operator+(double a, const CVector& v);                   // a<op>v
00104 friend CVector operator-(const CVector& v, double a);                   // v<op>a
00105 friend CVector operator-(double a, const CVector& v);                   // a<op>v
00106 friend CVector operator*(const CVector& v, double a);                   // v<op>a
00107 friend CVector operator*(double a,const  CVector& v);                   // a<op>v
00108 friend CVector operator/(const CVector& v, double a);                   // v<op>a
00109 
00110 friend CVector operator+(const CVector& v, const RComplex& a);                  // v<op>a
00111 friend CVector operator+(const RComplex& a, const CVector& v);                  // a<op>v
00112 friend CVector operator-(const CVector& v, const RComplex& a);                  // v<op>a
00113 friend CVector operator-(const RComplex& a, const CVector& v);                  // a<op>v
00114 friend CVector operator*( const CVector& v, const RComplex& a);                 // v<op>a
00115 friend CVector operator*(const RComplex& a,const  CVector& v);                  // a<op>v
00116 friend CVector operator/(const  CVector& v, const RComplex& a);                 // v<op>a
00117 
00118 friend CVector operator+(const CVector& v1, const CVector& v2);                 // v1<op>v2
00119 friend CVector operator-(const CVector& v1, const CVector& v2);                 // v1<op>v2
00120         
00121 void output();
00122 void output(FILE* file);
00123 };
00124 
00125 #endif
00126 
00127  
00128 
00129          
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