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 Sergey Lisitsyn 00008 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society 00009 */ 00010 00011 #include <shogun/lib/config.h> 00012 00013 #ifndef CAUCHYKERNEL_H_ 00014 #define CAUCHYKERNEL_H_ 00015 00016 #include <shogun/lib/common.h> 00017 #include <shogun/kernel/Kernel.h> 00018 #include <shogun/distance/Distance.h> 00019 00020 namespace shogun 00021 { 00022 00023 class CDistance; 00024 00035 class CCauchyKernel: public CKernel 00036 { 00037 public: 00039 CCauchyKernel(); 00040 00046 CCauchyKernel(int32_t cache, float64_t sigma, CDistance* dist); 00047 00054 CCauchyKernel(CFeatures *l, CFeatures *r, float64_t sigma, CDistance* dist); 00055 00061 virtual bool init(CFeatures* l, CFeatures* r); 00062 00066 virtual EKernelType get_kernel_type() { return K_CAUCHY; } 00067 00071 virtual EFeatureType get_feature_type() { return m_distance->get_feature_type(); } 00072 00076 virtual EFeatureClass get_feature_class() { return m_distance->get_feature_class(); } 00077 00081 virtual const char* get_name() const { return "CauchyKernel"; } 00082 00083 virtual ~CCauchyKernel(); 00084 00085 protected: 00086 00094 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00095 00096 private: 00097 00098 void init(); 00099 00100 protected: 00101 00103 CDistance* m_distance; 00104 00106 float64_t m_sigma; 00107 00108 }; 00109 00110 } 00111 00112 #endif /* CAUCHYKERNEL_H_ */