Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

SingleUnitFastIca.hpp

00001 #ifndef __SingleUnitFastIca__
00002 #define __SingleUnitFastIca__
00003 
00027 #include "AContrastFunction.hpp"
00028 #include "RealVector.hpp"
00029 #include "RealSMatrix.hpp"
00030 
00031 class SingleUnitFastIca 
00032 {
00033 protected:
00034 
00035 AContrastFunction*      contrast;
00036 
00037 RealVector*                     wold;
00038 RealVector*                     w;
00039 
00040 int                             count;
00041 RealVector*                     evg;                    // cummulate estimation needed in FastICA
00042 RealVector*                     evg_Cinv;               // used in case unsphered data
00043 double                  evgdiff;
00044 
00045 double                  epsilon;
00046 
00047 public:
00048 
00049 SingleUnitFastIca(double eps=1.0e-4);
00050 SingleUnitFastIca(AContrastFunction* func, double eps)
00051                 {contrast=func; w=0; wold=0; evg=0; evgdiff=0.0; count=0; epsilon=eps; }
00052 virtual ~SingleUnitFastIca()
00053  {
00054  if( w != 0 )
00055         { 
00056         delete w;
00057         delete wold;
00058 
00059         delete evg;
00060         }
00061  }
00062 
00063 virtual void set(AContrastFunction*     func){contrast= func;}
00064 
00065 virtual RealVector* getW(){return w;}
00066 
00067 // learning
00068 virtual void init(int size);
00069 
00070 virtual void startLearning()
00071         { count=0; evg->setAll(0.0); evg_Cinv->setAll(0.0); evgdiff=0.0; } // to use to start a new iteration
00072 virtual void learn(RealVector* sample);
00073 virtual bool endLearning();
00074 virtual bool endLearning(RealSMatrix* C, RealSMatrix* Cinv);
00075 
00076 virtual void normalizeW();                      // w/||w||
00077 virtual void normalizeW(RealSMatrix* C);  // w/sqrt(wT*C*w)
00078 
00079 // out
00080 virtual double forward(RealVector* src);                // maximise absolute value of kurtosis
00081 
00082 virtual void output()
00083         {
00084         printf("Single Unit FastICA");
00085         }                               
00086 };
00087 
00088 #endif
SourceForge.net Logo
Restoreinpaint sourceforge project `C++/Java Image Processing, Restoration, Inpainting Project'.

Bernard De Cuyper: Open Project Leader: Concept, design and development.
Bernard De Cuyper & Eddy Fraiha 2002, 2003. Bernard De Cuyper 2004. Open and free, for friendly usage only.
Modifications on Belgium ground of this piece of artistic work, by governement institutions or companies, must be notified to Bernard De Cuyper.
bern_bdc@hotmail.com