SHOGUN
v2.0.0
|
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) 2011 Ziyuan Lin 00008 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society 00009 */ 00010 00011 #ifndef BESSELKERNEL_H_ 00012 #define BESSELKERNEL_H_ 00013 00014 #include <shogun/lib/common.h> 00015 #include <shogun/kernel/Kernel.h> 00016 #include <shogun/kernel/DistanceKernel.h> 00017 00018 namespace shogun 00019 { 00020 class CDistance; 00032 class CBesselKernel: public CDistanceKernel 00033 { 00034 public: 00036 CBesselKernel(); 00037 00046 CBesselKernel(int32_t size, float64_t order, 00047 float64_t width, int32_t degree, 00048 CDistance* dist); 00049 00060 CBesselKernel(CFeatures* l, CFeatures* r, 00061 float64_t order, float64_t width, int32_t degree, 00062 CDistance* dist, int32_t size=10); 00063 00067 virtual ~CBesselKernel(); 00068 00075 virtual bool init(CFeatures* l, CFeatures* r); 00076 00078 virtual void cleanup(); 00079 00084 virtual EKernelType get_kernel_type() 00085 { 00086 return K_BESSEL; 00087 } 00088 00092 inline virtual EFeatureType get_feature_type() 00093 { 00094 return distance->get_feature_type(); 00095 } 00096 00100 inline virtual EFeatureClass get_feature_class() 00101 { 00102 return distance->get_feature_class(); 00103 } 00104 00109 inline virtual const char* get_name() const 00110 { 00111 return "BesselKernel"; 00112 } 00113 00118 inline virtual void set_order(float64_t v) 00119 { 00120 order = v; 00121 } 00122 00127 inline virtual float64_t get_order() const 00128 { 00129 return order; 00130 } 00131 00136 inline virtual void set_width(float64_t tau) 00137 { 00138 width = tau; 00139 } 00140 00145 inline virtual float64_t get_width() const 00146 { 00147 return width; 00148 } 00149 00154 inline virtual void set_degree(int32_t n) 00155 { 00156 degree = n; 00157 } 00158 00163 inline virtual int32_t get_degree() const 00164 { 00165 return degree; 00166 } 00167 00168 protected: 00169 float64_t compute(int32_t idx_a, int32_t idx_b); 00170 00171 private: 00172 void init(); 00173 00174 protected: 00176 float64_t order; 00178 int32_t degree; 00179 }; 00180 00181 } 00182 00183 #endif /* BESSELKERNEL_H_ */