Main Page   Namespace List   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 Tue May 27 21:56:16 2003 for Wavelet compression, determinism and time series forecasting by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001