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 Abhinav Maurya 00008 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society 00009 * Copyright (C) 2011 Indian Institute of Technology Bombay 00010 */ 00011 00012 #include <shogun/lib/config.h> 00013 00014 #ifndef _CIRCULARKERNEL_H__ 00015 #define _CIRCULARKERNEL_H__ 00016 00017 #include <shogun/lib/common.h> 00018 #include <shogun/kernel/Kernel.h> 00019 #include <shogun/distance/Distance.h> 00020 00021 namespace shogun 00022 { 00023 00024 class CDistance; 00025 00038 class CCircularKernel: public CKernel 00039 { 00040 public: 00042 CCircularKernel(); 00043 00050 CCircularKernel(int32_t size, float64_t sigma, CDistance* dist); 00051 00059 CCircularKernel(CFeatures *l, CFeatures *r, float64_t sigma, CDistance* dist); 00060 00067 virtual bool init(CFeatures* l, CFeatures* r); 00068 00072 inline virtual EKernelType get_kernel_type() { return K_CIRCULAR; } 00073 00077 inline virtual EFeatureType get_feature_type() { return distance->get_feature_type(); } 00078 00082 inline virtual EFeatureClass get_feature_class() { return distance->get_feature_class(); } 00083 00087 inline virtual const char* get_name() const { return "CircularKernel"; } 00088 00093 inline virtual void set_sigma(float64_t s) 00094 { 00095 sigma=s; 00096 } 00097 00102 inline virtual float64_t get_sigma() const 00103 { 00104 return sigma; 00105 } 00106 00107 virtual ~CCircularKernel(); 00108 00117 virtual void load_serializable_post() throw (ShogunException); 00118 00128 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00129 00130 private: 00131 void init(); 00132 00133 protected: 00134 00136 CDistance* distance; 00137 00139 float64_t sigma; 00140 00141 }; 00142 } 00143 00144 #endif /* _CIRCULARKERNEL_H__ */