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

costshannon.cpp

Go to the documentation of this file.
00001 
00002 #include <assert.h>
00003 #include <stdio.h>
00004 #include <math.h>
00005 
00006 #include "costshannon.h"
00007 
00008 
00021 double costshannon::costCalc( packnode<double> *node )
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

Generated at Sat Aug 10 13:23:34 2002 for Wavelet Packet Transform and Lossless Compression by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001