Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

haar_classicFreq.h

Go to the documentation of this file.
00001 
00002 #ifndef _HAAR_CLASSICFREQ_H_
00003 #define _HAAR_CLASSICFREQ_H_
00004 
00005 #include "haar_classic.h"
00006 
00078 template <class T>
00079 class haar_classicFreq : public haar_classic<T> {
00080 protected:
00081 
00092   void predictRev( T& vec, int N, transDirection direction ) 
00093   {
00094     int half = N >> 1;
00095     int cnt = 0;
00096 
00097     for (int i = 0; i < half; i++) {
00098       int j = i + half;
00099 
00100       if (direction == forward) {
00101         vec[i] = (vec[i] - vec[j] )/2;
00102       }
00103       else if (direction == inverse) {
00104         vec[i] =  (2 * vec[i]) + vec[j];
00105       }
00106       else {
00107         printf("predictRev: bad direction value\n");
00108       }
00109     }
00110   } // predictRev
00111 
00112 
00127   void updateRev( T& vec, int N, transDirection direction )
00128   {
00129     int half = N >> 1;
00130 
00131     for (int i = 0; i < half; i++) {
00132       int j = i + half;
00133 
00134       if (direction == forward) {
00135         vec[j] = vec[j] + vec[i];
00136       }
00137       else if (direction == inverse) {
00138         vec[j] = vec[j] - vec[i];
00139       }
00140       else {
00141         printf("updateRev: bad direction value\n");
00142       }
00143     }
00144   } // updateRev
00145 
00146 public:
00147 
00154   void forwardStepRev( T& vec, const int n )
00155   {
00156     split( vec, n ); 
00157     predictRev( vec, n, forward );
00158     updateRev( vec, n, forward );
00159   }
00160 
00167   void inverseStepRev( T& vec, const int n )
00168   {
00169     updateRev( vec, n, inverse );
00170     predictRev( vec, n, inverse );
00171     merge( vec, n );
00172   }
00173   
00174 }; // haar_classicFreq
00175 
00176 
00177 #endif

Generated at Tue May 27 21:56:16 2003 for Wavelet compression, determinism and time series forecasting by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001