libwt  1.0.0
A C++ library for the continous wavelet transform.
wavelet.hh
1 
4 #ifndef __WT_WAVELET_HH__
5 #define __WT_WAVELET_HH__
6 
7 #include "types.hh"
8 
9 namespace wt {
10 
12 class WaveletObj: public Object
13 {
14 protected:
16  WaveletObj();
17 
18 public:
20  virtual ~WaveletObj();
23  virtual CScalar evalAnalysis(const Scalar &t) const = 0;
26  virtual CScalar evalSynthesis(const Scalar &t) const = 0;
29  virtual double cutOffTime() const = 0;
32  virtual double cutOffFreq() const = 0;
33 };
34 
35 
40 class Wavelet : public Container
41 {
42 public:
45 
46 public:
48  Wavelet();
50  Wavelet(WaveletObj *obj);
52  Wavelet(const Wavelet &other);
55  virtual ~Wavelet();
56 
58  Wavelet &operator=(const Wavelet &other);
59 
61  inline CScalar evalAnalysis(const Scalar &t) const {
62  return _wavelet->evalAnalysis(t);
63  }
64 
66  inline CScalar evalSynthesis(const Scalar &t) const {
67  return _wavelet->evalSynthesis(t);
68  }
69 
71  inline double cutOffTime() const {
72  return _wavelet->cutOffTime();
73  }
74 
76  inline double cutOffFreq() const {
77  return _wavelet->cutOffFreq();
78  }
79 
80 protected:
83 };
84 
85 
88 class MorletObj: public WaveletObj
89 {
90 public:
93  explicit MorletObj(double dff=2);
95  virtual ~MorletObj();
97  virtual CScalar evalAnalysis(const Scalar &t) const;
99  virtual CScalar evalSynthesis(const Scalar &t) const;
101  virtual double cutOffTime() const;
103  virtual double cutOffFreq() const;
104 
105 protected:
107  double _dff;
108 };
109 
110 
119 class Morlet: public Wavelet
120 {
121 public:
124  Morlet(double dff=2.0);
127  explicit Morlet(MorletObj *obj);
129  Morlet(const Morlet &other);
131  virtual ~Morlet();
133  Morlet &operator=(const Morlet &other);
134 
135 protected:
138 };
139 
140 
143 class CauchyObj: public WaveletObj
144 {
145 public:
148  explicit CauchyObj(double alpha=1);
150  virtual ~CauchyObj();
152  virtual CScalar evalAnalysis(const Scalar &t) const;
154  virtual CScalar evalSynthesis(const Scalar &t) const;
156  virtual double cutOffTime() const;
158  virtual double cutOffFreq() const;
159 
160 protected:
162  double _alpha;
164  double _norm;
165 };
166 
169 class Cauchy: public Wavelet
170 {
171 public:
174  explicit Cauchy(double alpha=1.0);
176  Cauchy(CauchyObj *obj);
178  Cauchy(const Cauchy &other);
180  virtual ~Cauchy();
182  Cauchy &operator=(const Cauchy &other);
183 
184 protected:
187 };
188 
189 }
190 
191 #endif // __WT_WAVELET_HH__
virtual CScalar evalAnalysis(const Scalar &t) const
Evaluates the mother wavelet at the specified time.
Definition: wavelet.cc:67
double cutOffFreq() const
Returns the width of the wavelet in frequencies.
Definition: wavelet.hh:76
virtual double cutOffFreq() const =0
Returns the spectral width of the unscaled wavelet in frequency (frequency resolution).
Morlet & operator=(const Morlet &other)
Assignment operator, manages references.
Definition: wavelet.cc:115
virtual double cutOffTime() const
Returns the with of the mother wavelet in the time domain.
Definition: wavelet.cc:77
Base class of all wavelet (-pair) objects.
Definition: wavelet.hh:12
WaveletObj ObjectType
The object type of the container.
Definition: wavelet.hh:44
virtual double cutOffTime() const =0
Returns the "width" of the (unscaled) wavelet in time.
virtual ~WaveletObj()
Destructor.
Definition: wavelet.cc:15
CScalar evalSynthesis(const Scalar &t) const
Evaluates the (unscaled) analysis wavelet at the specified position.
Definition: wavelet.hh:66
MorletObj(double dff=2)
Constructor.
Definition: wavelet.cc:56
Cauchy & operator=(const Cauchy &other)
Assignment operator, manages references.
Definition: wavelet.cc:184
double cutOffTime() const
Returns the width of the wavelet in time.
Definition: wavelet.hh:71
WaveletObj * _wavelet
Holds a reference to the wavelet object.
Definition: wavelet.hh:82
virtual ~MorletObj()
Destructor.
Definition: wavelet.cc:62
CauchyObj * _cauchy
Holds a reference to the CauchyObj instance.
Definition: wavelet.hh:186
virtual ~CauchyObj()
Destructor.
Definition: wavelet.cc:134
CScalar evalAnalysis(const Scalar &t) const
Evaluates the (unscaled) analysis wavelet at the specified position.
Definition: wavelet.hh:61
Base class of all wavelet object containers.
Definition: wavelet.hh:40
virtual CScalar evalSynthesis(const Scalar &t) const
Evaluates the mother wavelet at the specified time.
Definition: wavelet.cc:72
CauchyObj(double alpha=1)
Constructor.
Definition: wavelet.cc:126
double _dff
Holds the frequency resolution parameter.
Definition: wavelet.hh:107
virtual double cutOffFreq() const
Returns the width of the mother wavelet in the frequency domain.
Definition: wavelet.cc:155
virtual CScalar evalAnalysis(const Scalar &t) const
Evaluates the mother wavelet at the given time.
Definition: wavelet.cc:139
virtual double cutOffTime() const
Returns the width of the mother wavelet in the time domain.
Definition: wavelet.cc:149
virtual CScalar evalSynthesis(const Scalar &t) const
Evaluates the mother wavelet at the given time.
Definition: wavelet.cc:144
virtual ~Morlet()
Destructor.
Definition: wavelet.cc:110
MorletObj * _morlet
Holds a reference to the actual instance MorletObj instance.
Definition: wavelet.hh:137
Base class of all container classes holding a managed reference to some Object.
Definition: object.hh:45
virtual CScalar evalSynthesis(const Scalar &t) const =0
Needs to be implemented by any specialization to evaluate the actual synthesis wavelet at time t...
virtual double cutOffFreq() const
Returns the with of the mother wavelet in the frequency domain.
Definition: wavelet.cc:83
Definition: convolution.hh:7
Wavelet & operator=(const Wavelet &other)
Assignment operator (reference counting).
Definition: wavelet.cc:46
The Morlet wavelet.
Definition: wavelet.hh:119
virtual ~Wavelet()
Destructor, will distroy the containing wavelet object if this was the last reference to it...
Definition: wavelet.cc:41
double _norm
Holds the normalization constant.
Definition: wavelet.hh:164
double _alpha
Holds the order.
Definition: wavelet.hh:162
Wavelet()
Emtpy constructor.
Definition: wavelet.cc:23
WaveletObj()
Hidden constructor.
Definition: wavelet.cc:9
Implementation of the Cauchy wavelet.
Definition: wavelet.hh:143
The Cauchy or Paul wavelet.
Definition: wavelet.hh:169
Cauchy(double alpha=1.0)
Constructor.
Definition: wavelet.cc:161
Morlet(double dff=2.0)
Constructor.
Definition: wavelet.cc:92
Implements the Morlet wavelet.
Definition: wavelet.hh:88
virtual CScalar evalAnalysis(const Scalar &t) const =0
Needs to be implemented by any specialization to evaluate the actual analysis wavelet at time t...
Base class of all managed objects.
Definition: object.hh:22
virtual ~Cauchy()
Destructor.
Definition: wavelet.cc:179