Logo coherent WaveBurst  
Library Reference Guide
Logo
wavecomplex.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Sergey Klimenko
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 /**********************************************************
20  * Package: Wavelet Analysis Tool
21  * this class defines complex numbers
22  * File name: wavecomplex.h
23  **********************************************************/
24 
25 #ifndef WAVECOMPLEX_HH
26 #define WAVECOMPLEX_HH
27 
28 #include <stdio.h>
29 #include <math.h>
30 #include "Rtypes.h" // used by THtml doc
31 
33 {
34 
35  public:
36 
37  wavecomplex(double,double); // Constructor
38 
39  wavecomplex(); // Default constructor
40 
41  wavecomplex(const wavecomplex&); // copy Constructor
42 
43  virtual ~wavecomplex(); // Destructor
44 
45 // operators
46 
48  virtual wavecomplex& operator+=(const wavecomplex &);
49  virtual wavecomplex& operator-=(const wavecomplex &);
50  virtual wavecomplex& operator*=(const wavecomplex &);
51  virtual wavecomplex& operator/=(const wavecomplex &);
52  virtual wavecomplex operator+ (const wavecomplex &);
53  virtual wavecomplex operator- (const wavecomplex &);
54  virtual wavecomplex operator* (const wavecomplex &);
55  virtual wavecomplex operator/ (const wavecomplex &);
56 
57  wavecomplex& operator= (const double);
58  virtual wavecomplex& operator+=(const double);
59  virtual wavecomplex& operator-=(const double);
60  virtual wavecomplex& operator*=(const double);
61  virtual wavecomplex& operator/=(const double);
62  virtual wavecomplex operator+ (const double);
63  virtual wavecomplex operator- (const double);
64  virtual wavecomplex operator* (const double);
65  virtual wavecomplex operator/ (const double);
66 
67 // member functions
68 
69  inline double real() const { return re; }
70  inline double imag() const { return im; }
71  inline double arg() const { return atan2(im,re); }
72  inline double abs() const { return re*re+im*im; }
73  inline double mod() const { return sqrt(re*re+im*im); }
74  inline void set(double x, double y) { re=x; im=y; return; }
75  inline wavecomplex conj() { wavecomplex z(re,-im); return z; }
76 
77 // private:
78 
79  double re; // real
80  double im; // imagenary
81 
82  // used by THtml doc
83  ClassDef(wavecomplex,1)
84 };
85 
86 #endif // WAVECOMPLEX_HH
double arg() const
Definition: wavecomplex.hh:71
virtual wavecomplex operator/(const wavecomplex &)
Definition: wavecomplex.cc:76
wavearray< double > z
Definition: Test10.C:32
double imag() const
Definition: wavecomplex.hh:70
wavecomplex conj()
Definition: wavecomplex.hh:75
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1) *itime+ifreq;double time=itime *dT;double freq=(ifreq >0) ? ifreq *dF :dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
virtual wavecomplex operator+(const wavecomplex &)
Definition: wavecomplex.cc:70
wavecomplex & operator=(const wavecomplex &)
Definition: wavecomplex.cc:47
virtual ~wavecomplex()
Definition: wavecomplex.cc:44
virtual wavecomplex & operator*=(const wavecomplex &)
Definition: wavecomplex.cc:54
virtual wavecomplex & operator-=(const wavecomplex &)
Definition: wavecomplex.cc:52
virtual wavecomplex operator-(const wavecomplex &)
Definition: wavecomplex.cc:72
double real() const
Definition: wavecomplex.hh:69
double mod() const
Definition: wavecomplex.hh:73
virtual wavecomplex & operator/=(const wavecomplex &)
Definition: wavecomplex.cc:61
double abs() const
Definition: wavecomplex.hh:72
virtual wavecomplex & operator+=(const wavecomplex &)
Definition: wavecomplex.cc:50
virtual wavecomplex operator*(const wavecomplex &)
Definition: wavecomplex.cc:74
wavearray< double > y
Definition: Test10.C:31