#include <costshannon.h>
Inheritance diagram for costshannon::

Public Methods | |
| costshannon (packnode< double > *node) | |
| Calculate a modified version of the the Shannon entropy cost function for the wavelet packet tree, filling in the cost value at each node. More... | |
Protected Methods | |
| double | costCalc (packnode< double > *node) | 
| An implementation of a modified version of the Shannon entropy function as a wavelet packet cost function. More... | |
Definition at line 50 of file costshannon.h.
      
  | 
  
| 
 Calculate a modified version of the the Shannon entropy cost function for the wavelet packet tree, filling in the cost value at each node. 
 Definition at line 60 of file costshannon.h. 00060 { traverse( node ); }
 | 
  
      
  | 
  
| 
 An implementation of a modified version of the Shannon entropy function as a wavelet packet cost function. This is described in section 8.3.2 of Ripples in Mathematics by Jensen and la Cour-Harbo. The log function here is the natural log (sometimes denoted as ln()). Note that the result of the entropy function is always negative. Reimplemented from costbase. Definition at line 21 of file costshannon.cpp. 00022 {
00023   assert( node != 0 );
00024 
00025   size_t len = node->length();
00026   const double *a = node->getData();
00027 
00028   double sum = 0.0;
00029   for (int i = 0; i < len; i++) {
00030     double val = 0.0;
00031     if (a[i] != 0.0) {
00032       double square = a[i] * a[i];
00033       val = square * log( square );
00034     }
00035     sum = sum + val;
00036   }
00037 
00038   return -sum;
00039 } // costshannon
 | 
  
1.2.8.1 written by Dimitri van Heesch,
 © 1997-2001