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

waveletDebug Class Reference

This class contains functions that are useful in debugging wavelet code. More...

#include <waveletDebug.h>

List of all members.

Public Methods

void pr_ordered (const double *coef, const size_t len)
 Print the result of a wavelet transform so that each coefficient spectrum is printed in its own block, showing the structure of the result. More...

void pr_intermediate (const double *vec, int N)
 Print wavelet transform intermediate results. More...

void pr_vector (const double *vec, const size_t N, const size_t len)
 Print the first N elements of vec. More...


Detailed Description

This class contains functions that are useful in debugging wavelet code.

Definition at line 11 of file waveletDebug.h.


Member Function Documentation

void waveletDebug::pr_intermediate ( const double * vec,
int N ) [inline]
 

Print wavelet transform intermediate results.

The wavelet transform calculates a set of averages and coefficients (differences). These are calculated recursively. For example, for a time series with size 32, the first iteration of the recursive wavelet transform will calculate a set of 16 averages and 16 coefficients (differences).

The next set of differences and avarages will be calculated at the start of the array (0..15) and will consist of 8 averages and 8 differences.

This function is passed a value for N which is the size of the average and difference spectrum. It prints each of these.

Definition at line 59 of file waveletDebug.h.

00060    {
00061       const char* fmt = "%7.4f ";
00062       int i;
00063       int half = N >> 1;
00064       
00065       printf(" ave = ");
00066       for (i = 0; i < half; i++) {
00067          printf(fmt, vec[i] );
00068       }
00069       printf("\n");
00070       printf("coef = ");
00071       for (i = half; i < N; i++) {
00072          printf(fmt, vec[i] );
00073       }
00074       printf("\n");
00075    } // pr_intermediate

void waveletDebug::pr_ordered ( const double * coef,
const size_t len ) [inline]
 

Print the result of a wavelet transform so that each coefficient spectrum is printed in its own block, showing the structure of the result.

Definition at line 19 of file waveletDebug.h.

00020    {
00021       const char *format = "%7.4f ";
00022       printf("{");
00023       int cnt = 0;
00024       int num_in_freq = 0;
00025       for (int i = 0; i < len; i++) {
00026          printf(format, coef[i]);
00027          cnt++;
00028          if (num_in_freq == 0) {
00029             printf("\n");
00030             cnt = 0;
00031             num_in_freq = 1;
00032          }
00033          else if (cnt == num_in_freq) {
00034             printf("\n");
00035             cnt = 0;
00036             num_in_freq = num_in_freq * 2;
00037          }
00038       }
00039       printf("}\n");
00040    } // pr_ordered

void waveletDebug::pr_vector ( const double * vec,
const size_t N,
const size_t len ) [inline]
 

Print the first N elements of vec.

If N is less than the length of vec the print a dividing mark (e.g., "|") and print the rest of the array.

This function is useful for displaying the flow of the wavelet computation.

Definition at line 86 of file waveletDebug.h.

00087    {
00088      const char* fmt = "%7.4f ";
00089 
00090      int i;
00091      for (i = 0; i < N; i++) {
00092        printf(fmt, vec[i] );
00093      }
00094 
00095      if (len != N) {
00096        printf(" | ");
00097        
00098        for (i = N; i < len; i++) {
00099          printf(fmt, vec[i] );
00100        }
00101      }
00102      printf("\n");
00103    } // pr_vector


The documentation for this class was generated from the following file:
Generated at Sun Aug 18 16:56:42 2002 for Wavelet Spectral Analysis by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001