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 _POLYMATCHSTRINGKERNEL_H___ 00012 #define _POLYMATCHSTRINGKERNEL_H___ 00013 00014 #include "lib/common.h" 00015 #include "kernel/StringKernel.h" 00016 00018 class CPolyMatchStringKernel: public CStringKernel<CHAR> 00019 { 00020 public: 00028 CPolyMatchStringKernel(INT size, INT degree, bool inhomogene, 00029 bool use_normalization=true); 00030 00039 CPolyMatchStringKernel( 00040 CStringFeatures<CHAR>* l, CStringFeatures<CHAR>* r, 00041 INT degree, bool inhomogene, bool use_normalization=true); 00042 00043 virtual ~CPolyMatchStringKernel(); 00044 00051 virtual bool init(CFeatures* l, CFeatures* r); 00052 00054 virtual void cleanup(); 00055 00061 virtual bool load_init(FILE* src); 00062 00068 virtual bool save_init(FILE* dest); 00069 00074 virtual EKernelType get_kernel_type() 00075 { 00076 return K_POLYMATCH; 00077 } 00078 00083 virtual const CHAR* get_name() 00084 { 00085 return "PolyMatchString"; 00086 } 00087 00088 protected: 00097 virtual DREAL compute(INT idx_a, INT idx_b); 00098 00099 protected: 00101 INT degree; 00103 bool inhomogene; 00105 bool use_normalization; 00106 00108 DREAL *sqrtdiag_lhs; 00110 DREAL *sqrtdiag_rhs; 00112 bool initialized; 00113 }; 00114 00115 #endif /* _POLYMATCHSTRINGKERNEL_H___ */