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

spectrum Class Reference

A collection of functions for spectral analysis. More...

#include <spectrum.h>

List of all members.

Static Public Methods

void spectralCalc (const double *a, const size_t N, std::vector< double > &v)
 Calculate the wavelet power spectrum from the result of the wavelet transform. More...

void copyBands (double *dest, const double *src, const size_t N, size_t startBand, const size_t endBand)
 Copy wavelet coefficient bands from startBand to endBand. More...


Private Methods

 spectrum ()
 This class is designed to provide static functions, not to be declared as a class instance. More...

 ~spectrum ()
 spectrum (const spectrum &rhs)


Detailed Description

A collection of functions for spectral analysis.

Definition at line 8 of file spectrum.h.


Constructor & Destructor Documentation

spectrum::spectrum ( ) [inline, private]
 

This class is designed to provide static functions, not to be declared as a class instance.

Definition at line 12 of file spectrum.h.

00012 {}

spectrum::~spectrum ( ) [inline, private]
 

Definition at line 13 of file spectrum.h.

00013 {}

spectrum::spectrum ( const spectrum & rhs ) [inline, private]
 

Definition at line 14 of file spectrum.h.

00014 {}


Member Function Documentation

void spectrum::copyBands ( double * dest,
const double * src,
const size_t N,
size_t startBand,
const size_t endBand ) [static]
 

Copy wavelet coefficient bands from startBand to endBand.

Elements in the destination array that are not copied are set to zero.

Definition at line 45 of file spectrum.cpp.

Referenced by main().

00050 {
00051   size_t end = 1;
00052   size_t start = 0;
00053   size_t bandCnt = 0;
00054 
00055   while (end <= N) {
00056     double power = 0;
00057     for (size_t i = start; i < end; i++) {
00058       if (bandCnt >= startBand && bandCnt <= endBand)
00059         dest[i] = src[i];
00060       else
00061         dest[i] = 0;
00062     }
00063     start = end;
00064     end = end << 1;
00065     bandCnt++;
00066   }
00067 } // copyBands

void spectrum::spectralCalc ( const double * a,
const size_t N,
std::vector< double > & v ) [static]
 

Calculate the wavelet power spectrum from the result of the wavelet transform.

The spectrum is calculated by calculating the power for each of the wavelet coefficient bands. The bands are ordered by increasing powers of two: 20, 21, 22...

Definition at line 16 of file spectrum.cpp.

Referenced by main().

00019 {
00020   size_t end = 1;
00021   size_t start = 0;
00022 
00023   while (end <= N) {
00024     double power = 0;
00025     for (size_t i = start; i < end; i++) {
00026       power = power + (a[i] * a[i]);
00027     }
00028     v.push_back( power );
00029     start = end;
00030     end = end << 1;
00031   }
00032 } // spectralCalc


The documentation for this class was generated from the following files:
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