Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
wavecomplex.cc
Go to the documentation of this file.
1 /*-------------------------------------------------------
2  * Package: Wavelet Analysis Tool
3  * complex class
4  * File name: wavecomplex.cc
5  *-------------------------------------------------------
6 */
7 
8 
9 #include <time.h>
10 #include <iostream>
11 #include "wavecomplex.hh"
12 
13 ClassImp(wavecomplex) // used by THtml doc
14 
15 //: constructors
17 { re = im = 0.; }
18 wavecomplex::wavecomplex(double a, double b)
19 { re = a; im = b; }
20 
21 //: copy constructor
23 { *this = a; }
24 
25 //: destructor
27 
28 //: operators
30 { re=a.real(); im=a.imag(); return *this; }
31 
33 { re+=a.real(); im+=a.imag(); return *this; }
35 { re-=a.real(); im-=a.imag(); return *this; }
37 {
38  double x = re*a.real()-im*a.imag();
39  im = re*a.imag()+im*a.real();
40  re = x;
41  return *this;
42 }
44 {
45  double x = a.abs();
46  double y = (re*a.real()+im*a.imag())/x;
47  im = (im*a.real()-re*a.imag())/x;
48  re = y;
49  return *this;
50 }
51 
53 { wavecomplex z = *this; z+=a; return z; }
55 { wavecomplex z = *this; z-=a; return z; }
57 { wavecomplex z = *this; z*=a; return z; }
59 { wavecomplex z = *this; z/=a; return z; }
60 
61 
63 { re=c; im=0.; return *this; }
64 
66 { re+=c; return *this; }
68 { re-=c; return *this;}
70 { re*=c; im*=c; return *this;}
72 { re/=c; im/=c; return *this;}
73 
75 { wavecomplex z = *this; z+=c; return z;}
77 { wavecomplex z = *this; z-=c; return z;}
79 { wavecomplex z = *this; z*=c; return z;}
81 { wavecomplex z = *this; z/=c; return z;}
82 
83 
84 
double imag() const
Definition: wavecomplex.hh:52
virtual wavecomplex operator/(const wavecomplex &)
Definition: wavecomplex.cc:58
wavearray< double > a(hp.size())
wavearray< double > z
Definition: Test10.C:32
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<< "\t layers : "<< nLAYERS<< "\t dF(hz) : "<< dF<< "\t 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:52
wavecomplex & operator=(const wavecomplex &)
Definition: wavecomplex.cc:29
double real() const
Definition: wavecomplex.hh:51
virtual ~wavecomplex()
Definition: wavecomplex.cc:26
virtual wavecomplex & operator*=(const wavecomplex &)
Definition: wavecomplex.cc:36
virtual wavecomplex & operator-=(const wavecomplex &)
Definition: wavecomplex.cc:34
virtual wavecomplex operator-(const wavecomplex &)
Definition: wavecomplex.cc:54
virtual wavecomplex & operator/=(const wavecomplex &)
Definition: wavecomplex.cc:43
double abs() const
Definition: wavecomplex.hh:54
virtual wavecomplex & operator+=(const wavecomplex &)
Definition: wavecomplex.cc:32
virtual wavecomplex operator*(const wavecomplex &)
Definition: wavecomplex.cc:56
wavearray< double > y
Definition: Test10.C:31