#include "waveletDebug.h"
#include "polyHaar.h"
Go to the source code of this file.
Functions | |
| bool | compare (const double *v1, const double *v2, const size_t N) |
| Compare two integer arrays of size N. More... | |
| double* | copy (double *vec, const size_t N) |
| Make a copy of an integer array. More... | |
| main () | |
| \function. More... | |
Variables | |
| double | data [] |
Definition in file polytest.cpp.
|
|
Compare two integer arrays of size N. Return true if they are equal, false otherwise. Definition at line 18 of file polytest.cpp. 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
|
|
|
Make a copy of an integer array. Note that the function allocates memory, but does not deallocate it. Definition at line 40 of file polytest.cpp. 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
|
|
|
\function. The entry point for code to test the wavelet packet transform. The code in main provides a simple example of how to call the wavelet packet transform code. This test case can be used with various wavelet functions (e.g., Haar, linear interpolation, Daubechies D4, polynomial interpolation). In the context of filters, the polynomial interpolation wavelets (see poly.h and polyHaar.h) are very bad choices. The polynomial interpolation wavelets do not divide the spectrum into high and low frequency components. Instead, the power spectrum shows one peak. I'm not sure if this means that the polynomial interpolation wavelets are bad for all applications. For example, another way to look at wavelets is as approximation functions. For example, wavelet compression relies approximation functions. In this case polynomial wavelets may be a good choice for some data sets. Definition at line 53 of file polytest.cpp. 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 }
|
|
|
Initial value: { 32.0, 10.0, 20.0, 38.0, 37.0, 28.0, 38.0, 34.0,
18.0, 24.0, 18.0, 9.0, 23.0, 24.0, 28.0, 34.0 }Definition at line 9 of file polytest.cpp. |
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001