00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 1999-2008 Gunnar Raetsch 00008 * Written (W) 1999-2008 Soeren Sonnenburg 00009 * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society 00010 */ 00011 00012 #ifndef _CPCACUT__H__ 00013 #define _CPCACUT__H__ 00014 00015 #include "lib/config.h" 00016 00017 #ifdef HAVE_LAPACK 00018 00019 #include <stdio.h> 00020 00021 #include "preproc/SimplePreProc.h" 00022 #include "features/Features.h" 00023 #include "lib/common.h" 00024 00025 00027 class CPCACut : public CSimplePreProc<DREAL> 00028 { 00029 public: 00035 CPCACut(INT do_whitening=0, double thresh=1e-6); 00036 virtual ~CPCACut(); 00037 00039 virtual bool init(CFeatures* f); 00041 virtual bool load_init_data(FILE* src); 00043 virtual bool save_init_data(FILE* dst); 00045 virtual void cleanup(); 00046 00050 virtual DREAL* apply_to_feature_matrix(CFeatures* f); 00051 00054 virtual DREAL* apply_to_feature_vector(DREAL* f, INT &len); 00055 00056 protected: 00058 double* T ; 00060 INT num_dim; 00062 INT num_old_dim; 00064 double *mean ; 00065 00067 bool initialized; 00068 00070 INT do_whitening; 00072 double thresh; 00073 }; 00074 #endif 00075 #endif