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 Soeren Sonnenburg 00008 * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _CHI2KERNEL_H___ 00012 #define _CHI2KERNEL_H___ 00013 00014 #include "lib/common.h" 00015 #include "kernel/SimpleKernel.h" 00016 #include "features/Features.h" 00017 #include "features/RealFeatures.h" 00018 00029 class CChi2Kernel: public CSimpleKernel<DREAL> 00030 { 00031 public: 00037 CChi2Kernel(INT size, DREAL width); 00038 00046 CChi2Kernel(CRealFeatures* l, CRealFeatures* r, 00047 DREAL width, INT size); 00048 00049 virtual ~CChi2Kernel(); 00050 00057 virtual bool init(CFeatures* l, CFeatures* r); 00058 00064 virtual bool load_init(FILE* src); 00065 00071 virtual bool save_init(FILE* dest); 00072 00077 virtual EKernelType get_kernel_type() { return K_CHI2; } 00078 00083 virtual const CHAR* get_name() { return "Chi2"; }; 00084 00085 protected: 00094 virtual DREAL compute(INT idx_a, INT idx_b); 00095 00096 protected: 00098 DREAL width; 00099 }; 00100 00101 #endif /* _CHI2KERNEL_H__ */ 00102 00103