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

packnode Class Template Reference

A wavelet packet tree node. More...

#include <packnode.h>

Inheritance diagram for packnode::

packdata List of all members.

Public Methods

 packnode (T *vec, const size_t n, const transformKind k)
 Packnode constructor. More...

T& operator[] (const size_t i)
 LHS [] operator. More...

operator[] (const size_t i) const
 RHS [] operator. More...

void prCost () const
 print the cost value. More...

void prBestBasis () const
 if the node is selected as part of the best basis function, print it. More...

void lhsChild (packnode *l)
 set the left child pointer. More...

packnode* lhsChild (void)
 get the left child pointer. More...

void rhsChild (packnode *r)
 set the right child pointer. More...

packnode* rhsChild (void)
 get the right child pointer. More...

void cost (T val)
 set the cost value for the node. More...

cost (void)
 get the cost value for the node. More...

void mark (bool b)
 the "chosen" flag marks a node for inclusion in the best basis set. More...

bool mark ()
 return the value of the "mark" boolean flag. More...


Private Methods

 packnode (const packnode &rhs)
 disallow the copy constructor. More...

 packnode ()
 disallow default constructor. More...


Private Attributes

packnode* leftChild
 left child (with N/2) data elements. More...

packnode* rightChild
 right child (with N/2) data elements. More...

costVal
 cost value for this level. More...

bool chosen
 chosen == true: node is part of the best basis of the wavelet transform, otherwise, false. More...


Detailed Description

template<class T> class packnode

A wavelet packet tree node.

A description of the wavelet packet algorithm can be found in Chapter 8 of Ripples in Mathematics by Jensen and la Cour-Harbo.

For a data set consisting of N data elements, the wavelet packet algorithm will build a binary tree with log2(N) levels. Since it is a binary tree, the number of nodes doubles at each level. At the same time, the amount of data that is stored in each node is halved.

A node will have n data elements. The two children will each have n/2 elements, stored in packnode children.

A pointer to the data vector for the node and the length of the data is set by the class constructor.

Once the wavelet packet tree is built a cost value is assigned to each node in the tree.

Definition at line 63 of file packnode.h.


Constructor & Destructor Documentation

template<class T>
packnode<T>::packnode<T> ( const packnode<T> & rhs ) [inline, private]
 

disallow the copy constructor.

Definition at line 81 of file packnode.h.

00081 {};

template<class T>
packnode<T>::packnode<T> ( ) [inline, private]
 

disallow default constructor.

Definition at line 83 of file packnode.h.

00083 {};

template<class T>
packnode<T>::packnode<T> ( T * vec,
const size_t n,
const transformKind k ) [inline]
 

Packnode constructor.

Definition at line 90 of file packnode.h.

00092                                     : packdata<T>(vec, n, k)
00093   {
00094     leftChild = 0;
00095     rightChild = 0;
00096     costVal = 0.0;
00097     chosen = false;
00098   }


Member Function Documentation

template<class T>
T packnode<T>::cost ( void ) [inline]
 

get the cost value for the node.

Definition at line 151 of file packnode.h.

Referenced by packtree_int::bestBasisWalk(), packtree::bestBasisWalk(), costbase_int::traverse(), and costbase::traverse().

00151 { return costVal; }

template<class T>
void packnode<T>::cost ( T val ) [inline]
 

set the cost value for the node.

Definition at line 149 of file packnode.h.

00149 { costVal = val; }

template<class T>
packnode<T> * packnode<T>::lhsChild ( void ) [inline]
 

get the left child pointer.

Definition at line 141 of file packnode.h.

Referenced by packtree_int::bestBasisWalk(), packtree::bestBasisWalk(), packtree_base_int::breadthFirstPrint(), packtree_base::breadthFirstPrint(), packtree_int::buildBestBasisList(), packtree::buildBestBasisList(), packtree_int::checkBestBasis(), packtree::checkBestBasis(), packtree_int::cleanTree(), packtree::cleanTree(), packfreq::findLevel(), packtree_base_int::newLevel(), packtree_base::newLevel(), costbase_int::traverse(), and costbase::traverse().

00141 { return leftChild; }

template<class T>
void packnode<T>::lhsChild ( packnode<T> * l ) [inline]
 

set the left child pointer.

Definition at line 139 of file packnode.h.

00139 { leftChild = l; }

template<class T>
bool packnode<T>::mark ( ) [inline]
 

return the value of the "mark" boolean flag.

Definition at line 158 of file packnode.h.

Referenced by packtree_int::bestBasisWalk(), packtree::bestBasisWalk(), packtree_int::buildBestBasisList(), packtree::buildBestBasisList(), packtree_int::checkBestBasis(), packtree::checkBestBasis(), packtree_int::cleanTree(), packtree::cleanTree(), packtree_base_int::newLevel(), and packtree_base::newLevel().

00158 { return chosen; }

template<class T>
void packnode<T>::mark ( bool b ) [inline]
 

the "chosen" flag marks a node for inclusion in the best basis set.

Definition at line 156 of file packnode.h.

00156 { chosen = b; }

template<class T>
T packnode<T>::operator[] ( const size_t i ) const [inline]
 

RHS [] operator.

Definition at line 109 of file packnode.h.

00110   {
00111     assert( i < N );
00112     return data[i];
00113   }

template<class T>
T & packnode<T>::operator[] ( const size_t i ) [inline]
 

LHS [] operator.

Definition at line 102 of file packnode.h.

00103   {
00104     assert( i < N );
00105     return data[i];
00106   }

template<class T>
void packnode<T>::prBestBasis ( ) const [inline]
 

if the node is selected as part of the best basis function, print it.

Definition at line 126 of file packnode.h.

Referenced by packtree_base_int::breadthFirstPrint(), and packtree_base::breadthFirstPrint().

00127   {
00128     for (int i = 0; i < N; i++) {
00129       printf("%7.4f ", data[i] );
00130     }
00131     if (chosen) {
00132       printf("  *");
00133     }
00134     printf("\n");
00135   } // prBestBasis

template<class T>
void packnode<T>::prCost ( ) const [inline]
 

print the cost value.

Definition at line 117 of file packnode.h.

Referenced by packtree_base_int::breadthFirstPrint(), and packtree_base::breadthFirstPrint().

00118   {
00119     printf("%7.4f\n", costVal );
00120   }

template<class T>
packnode<T> * packnode<T>::rhsChild ( void ) [inline]
 

get the right child pointer.

Definition at line 146 of file packnode.h.

Referenced by packtree_int::bestBasisWalk(), packtree::bestBasisWalk(), packtree_base_int::breadthFirstPrint(), packtree_base::breadthFirstPrint(), packtree_int::buildBestBasisList(), packtree::buildBestBasisList(), packtree_int::checkBestBasis(), packtree::checkBestBasis(), packtree_int::cleanTree(), packtree::cleanTree(), packfreq::findLevel(), packtree_base_int::newLevel(), packtree_base::newLevel(), costbase_int::traverse(), and costbase::traverse().

00146 { return rightChild; }

template<class T>
void packnode<T>::rhsChild ( packnode<T> * r ) [inline]
 

set the right child pointer.

Definition at line 144 of file packnode.h.

00144 { rightChild = r; }


Member Data Documentation

template<class T>
bool packnode<T>::chosen [private]
 

chosen == true: node is part of the best basis of the wavelet transform, otherwise, false.

Definition at line 77 of file packnode.h.

template<class T>
T packnode<T>::costVal [private]
 

cost value for this level.

Definition at line 73 of file packnode.h.

template<class T>
packnode<T> * packnode<T>::leftChild [private]
 

left child (with N/2) data elements.

Definition at line 68 of file packnode.h.

template<class T>
packnode<T> * packnode<T>::rightChild [private]
 

right child (with N/2) data elements.

Definition at line 70 of file packnode.h.


The documentation for this class was generated from the following file:
Generated at Tue May 27 21:56:17 2003 for Wavelet compression, determinism and time series forecasting by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001