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

costshannon Class Reference

The costshannon class extends the abstract class costbase with a concrete implementation of the costCalc function that implements the a modified version of the Shannon entropy function as a cost function. More...

#include <costshannon.h>

Inheritance diagram for costshannon::

costbase List of all members.

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...


Detailed Description

The costshannon class extends the abstract class costbase with a concrete implementation of the costCalc function that implements the a modified version of the Shannon entropy function as a cost function.

Author:
Ian Kaplan

Definition at line 50 of file costshannon.h.


Constructor & Destructor Documentation

costshannon::costshannon ( packnode< double > * node ) [inline]
 

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 ); }


Member Function Documentation

double costshannon::costCalc ( packnode< double > * node ) [protected, virtual]
 

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


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