FlyoDoc_2011 Pisa 2011 by GmP --- 011
|
00001 /*************************************************************************** 00002 gcomplx.h - description 00003 ------------------- 00004 begin : Wed Aug 15 2001 00005 copyright : (C) 2001 by Giuseppe Pierazzini 00006 email : peppe@unipi.it 00007 ***************************************************************************/ 00008 00009 #ifndef GCOMPLX_H 00010 #define GCOMPLX_H 00011 00012 00018 class Gcomplx 00019 { 00020 private: 00021 double real,imm; 00022 00023 public: 00024 double norma,normaq; 00025 //---- 00026 Gcomplx(double=0.0); 00027 Gcomplx(double,double); 00028 ~Gcomplx(); 00029 //----- 00030 double Norma( ); 00031 double& operator[](int); 00032 Gcomplx& operator=(Gcomplx&); // assegnamento this= &c 00033 Gcomplx& operator=(Gcomplx *); // assegnamento this = *c 00034 Gcomplx& operator=(double *); // this = (a,a) vedi nche set. 00035 Gcomplx& operator=(double ); 00036 00037 // operatore unario di cambio segno 00038 Gcomplx& operator-(); 00039 00040 // somma e differenze 00041 Gcomplx& operator+(Gcomplx &); 00042 Gcomplx& operator+(Gcomplx *); 00043 Gcomplx& operator+(double); 00044 friend Gcomplx& operator+(double,Gcomplx &); 00045 00046 Gcomplx& operator-(Gcomplx &); 00047 Gcomplx& operator-(Gcomplx *); 00048 Gcomplx& operator-(double); 00049 friend Gcomplx& operator-(double,Gcomplx &); 00050 00051 00052 // incrementi 00053 Gcomplx & operator+=(Gcomplx *); //this+=c 00054 Gcomplx & operator+=(Gcomplx&); //this+=c 00055 Gcomplx & operator+=(double); //this+=reale 00056 Gcomplx & operator-=(Gcomplx *); //this-=c; 00057 Gcomplx & operator-=(Gcomplx&); //this-=c 00058 Gcomplx & operator-=(double ); //this-=reale 00059 // prodotto scalare 00060 double operator%(Gcomplx &); // prodotto scalare 00061 double operator%(Gcomplx * ); // idem 00062 // friend double operator%(Gcomplx *,Gcomplx &); 00063 00064 // coniugata 00065 Gcomplx & operator&(); 00066 00067 00068 // prodotto 00069 Gcomplx & operator*(Gcomplx & ); 00070 Gcomplx & operator*(Gcomplx *); 00071 Gcomplx & operator*(double ); // prodotto per un parametro a*this 00072 friend Gcomplx & operator*(double,Gcomplx & ); 00073 Gcomplx & operator*=(Gcomplx & ); 00074 Gcomplx & operator*=(Gcomplx *A){return *this*=(*A);} 00075 00076 // rapporto 00077 Gcomplx & operator/(Gcomplx & ); 00078 Gcomplx & operator/(Gcomplx *); 00079 Gcomplx & operator/(double ); // divide per un parametro 00080 friend Gcomplx & operator/(double,Gcomplx &); // c/Gcomplex 00081 Gcomplx & operator/=(Gcomplx & ); 00082 Gcomplx & operator/=(Gcomplx *A){return *this/=(*A);} 00083 00084 // (1/c), c/|c| , 00085 Gcomplx & Inverso( ); 00086 Gcomplx & Verso( ); 00087 Gcomplx & Set(double,double ); 00088 double Real(){return real;} 00089 double Imm(){return imm;} 00090 00091 00092 void print(char *); 00093 }; 00094 00095 00096 00097 #endif