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

polytest.cpp

Go to the documentation of this file.
00001 
00002 #include "waveletDebug.h"
00003 #include "polyHaar.h"
00004 
00008 
00009 double data[] = { 32.0, 10.0, 20.0, 38.0, 37.0, 28.0, 38.0, 34.0,
00010                   18.0, 24.0, 18.0, 9.0, 23.0, 24.0, 28.0, 34.0 };
00011 
00012 
00013 
00018 bool compare( const double *v1, const double *v2, const size_t N )
00019 {
00020   bool rslt = true;
00021 
00022   for (size_t i = 0; i < N; i++) 
00023   {
00024     if (v1[i] != v2[i])
00025     {
00026       rslt = false;
00027       break;
00028     }
00029   }
00030 
00031   return rslt;
00032 } // compare
00033 
00034 
00040 double *copy( double *vec, const size_t N )
00041 {
00042   double *newVec = new double[ N ];
00043 
00044   for (size_t i = 0; i < N; i++)
00045   {
00046     newVec[i] = vec[i];
00047   }
00048 
00049   return newVec;
00050 } // copy
00051 
00052 
00053 main()
00054 {
00055   waveletDebug d;
00056   polyHaar<double *> w;
00057 
00058   size_t N = sizeof( data) / sizeof(double);
00059 
00060   double *copyVec = copy( data, N );
00061 
00062   double *ptr = data;
00063   w.forwardTrans( ptr, N );
00064   d.pr_ordered( data, N );
00065 
00066   w.inverseTrans( ptr, N );
00067 
00068   if (compare(data, copyVec, N))
00069     printf("inverse transform succeeded\n");
00070   else
00071     printf("inverse transform failed\n");
00072 
00073   return 0;
00074 }

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