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