Logo coherent WaveBurst  
Library Reference Guide
Logo
wavecomplex.cc
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  * complex class
22  * File name: wavecomplex.cc
23  *-------------------------------------------------------
24 */
25 
26 
27 #include <time.h>
28 #include <iostream>
29 #include "wavecomplex.hh"
30 
31 ClassImp(wavecomplex) // used by THtml doc
32 
33 //: constructors
35 { re = im = 0.; }
36 wavecomplex::wavecomplex(double a, double b)
37 { re = a; im = b; }
38 
39 //: copy constructor
41 { *this = a; }
42 
43 //: destructor
45 
46 //: operators
48 { re=a.real(); im=a.imag(); return *this; }
49 
51 { re+=a.real(); im+=a.imag(); return *this; }
53 { re-=a.real(); im-=a.imag(); return *this; }
55 {
56  double x = re*a.real()-im*a.imag();
57  im = re*a.imag()+im*a.real();
58  re = x;
59  return *this;
60 }
62 {
63  double x = a.abs();
64  double y = (re*a.real()+im*a.imag())/x;
65  im = (im*a.real()-re*a.imag())/x;
66  re = y;
67  return *this;
68 }
69 
71 { wavecomplex z = *this; z+=a; return z; }
73 { wavecomplex z = *this; z-=a; return z; }
75 { wavecomplex z = *this; z*=a; return z; }
77 { wavecomplex z = *this; z/=a; return z; }
78 
79 
81 { re=c; im=0.; return *this; }
82 
84 { re+=c; return *this; }
86 { re-=c; return *this;}
88 { re*=c; im*=c; return *this;}
90 { re/=c; im/=c; return *this;}
91 
93 { wavecomplex z = *this; z+=c; return z;}
95 { wavecomplex z = *this; z-=c; return z;}
97 { wavecomplex z = *this; z*=c; return z;}
99 { wavecomplex z = *this; z/=c; return z;}
100 
101 
102 
virtual wavecomplex operator/(const wavecomplex &)
Definition: wavecomplex.cc:76
wavearray< double > a(hp.size())
wavearray< double > z
Definition: Test10.C:32
double imag() const
Definition: wavecomplex.hh:70
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
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