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

costthresh.h

Go to the documentation of this file.
00001 
00002 #ifndef _COSTTHRESH_H_
00003 #define _COSTTHRESH_H_
00004 
00005 #include "costbase.h"
00006 #include "packnode.h"
00007 
00039 
00040 
00041 
00054 class costthresh : public costbase 
00055 {
00056 private:
00058   double thresh;
00059 
00061   double abs(const double x)
00062   {
00063     double retval = x;
00064     if (retval < 0.0)
00065       retval = -retval;
00066     return retval;
00067   } // abs
00068 
00069 protected:
00070 
00076   double costCalc(packnode<double> *node)
00077   {
00078     double count = 0.0;
00079     if (node != 0) {
00080       size_t len = node->length();
00081       for (int i = 0; i < len; i++) {
00082         if (abs((*node)[i]) > thresh) {
00083           count = count + 1.0;
00084         }
00085       }
00086     }
00087     return count;
00088   } // costCalc
00089 
00090 public:
00093   costthresh(packnode<double> *node, double t ) 
00094   { 
00095     thresh = t; 
00096     traverse( node );
00097   }
00098 }; // costthresh
00099 
00100 #endif

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