00001 #ifndef __FastIca__ 00002 #define __FastIca__ 00003 00027 #include "SingleUnitFastIca.hpp" 00028 #include "RealVector.hpp" 00029 00030 class FastIca 00031 { 00032 protected: 00033 00034 int n, nmax; 00035 SingleUnitFastIca** unit; 00036 00037 int count; 00038 00039 bool rawDataUsed; // non sphered data need covariance, but avoid PCA 00040 RealVector* mean; 00041 RealSMatrix* C; // covariance 00042 RealSMatrix* Cinv; // inverse of covariance 00043 00044 RealVector* wTnew_C; 00045 00046 double alpha; // if less than 1, partial decorrelation 00047 00048 public: 00049 00050 FastIca(int nx, double eps=1.0e-4, bool sphered=true, double ralpha=1.0); 00051 virtual ~FastIca(); 00052 00053 virtual int numberOfUnits(){return n;} 00054 virtual int maxUnits(){return nmax;} 00055 00056 virtual void add(SingleUnitFastIca* aunit); 00057 virtual void set(int i, AContrastFunction* func){return unit[i]->set(func);} 00058 00059 virtual SingleUnitFastIca* get(int i){return unit[i];} 00060 virtual RealVector* getW(int i){return unit[i]->getW();} 00061 00062 virtual int getBest(RealVector* src); 00063 00064 // learning 00065 virtual void init(int size); 00066 00067 virtual void startLearning(); // to use to start a new iteration on many samples 00068 virtual void learn(RealVector* sample); 00069 virtual bool endLearning(); // to update at the end of an iteration on many samples + deflation 00070 00071 // out 00072 virtual RealVector* forward(RealVector* src); // maximise absolute value of kurtosis 00073 00074 virtual void output() 00075 { 00076 printf("FastICA"); 00077 } 00078 }; 00079 00080 #endif