SparsePolyKernel.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _SPARSEPOLYKERNEL_H___
00012 #define _SPARSEPOLYKERNEL_H___
00013
00014 #include "lib/common.h"
00015 #include "kernel/SparseKernel.h"
00016 #include "features/SparseFeatures.h"
00017
00028 class CSparsePolyKernel: public CSparseKernel<DREAL>
00029 {
00030 public:
00040 CSparsePolyKernel(
00041 CSparseFeatures<DREAL>* l, CSparseFeatures<DREAL>* r,
00042 INT size, INT d, bool inhom, bool use_norm);
00043
00051 CSparsePolyKernel(INT size, INT degree,
00052 bool inhomogene=true, bool use_normalization=true);
00053
00054 virtual ~CSparsePolyKernel();
00055
00062 virtual bool init(CFeatures* l, CFeatures* r);
00063
00065 virtual void cleanup();
00066
00072 virtual bool load_init(FILE* src);
00073
00079 virtual bool save_init(FILE* dest);
00080
00085 inline virtual EFeatureType get_feature_type() { return F_DREAL; }
00086
00091 virtual EKernelType get_kernel_type() { return K_POLY; }
00092
00097 virtual const CHAR* get_name() { return "SparsePoly"; }
00098
00099 protected:
00108 virtual DREAL compute(INT idx_a, INT idx_b);
00109
00110 protected:
00112 INT degree;
00114 bool inhomogene;
00116 bool use_normalization;
00117
00119 DREAL *sqrtdiag_lhs;
00121 DREAL *sqrtdiag_rhs;
00123 bool initialized;
00124 };
00125
00126 #endif