#include <packnode.h>
Inheritance diagram for packnode::
Public Methods | |
packnode (T *vec, const size_t n, const transformKind k) | |
Packnode constructor. More... | |
T& | operator[] (const size_t i) |
LHS [] operator. More... | |
T | 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... | |
T | 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... | |
T | 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... |
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.
|
disallow the copy constructor.
Definition at line 81 of file packnode.h. 00081 {}; |
|
disallow default constructor.
Definition at line 83 of file packnode.h. 00083 {}; |
|
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 } |
|
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; } |
|
set the cost value for the node.
Definition at line 149 of file packnode.h. 00149 { costVal = val; } |
|
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; } |
|
set the left child pointer.
Definition at line 139 of file packnode.h. 00139 { leftChild = l; } |
|
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; } |
|
the "chosen" flag marks a node for inclusion in the best basis set.
Definition at line 156 of file packnode.h. 00156 { chosen = b; } |
|
RHS [] operator.
Definition at line 109 of file packnode.h. 00110 { 00111 assert( i < N ); 00112 return data[i]; 00113 } |
|
LHS [] operator.
Definition at line 102 of file packnode.h. 00103 { 00104 assert( i < N ); 00105 return data[i]; 00106 } |
|
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 |
|
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 } |
|
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; } |
|
set the right child pointer.
Definition at line 144 of file packnode.h. 00144 { rightChild = r; } |
|
chosen == true: node is part of the best basis of the wavelet transform, otherwise, false.
Definition at line 77 of file packnode.h. |
|
cost value for this level.
Definition at line 73 of file packnode.h. |
|
left child (with N/2) data elements.
Definition at line 68 of file packnode.h. |
|
right child (with N/2) data elements.
Definition at line 70 of file packnode.h. |