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-2009 Soeren Sonnenburg 00008 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _CONSTKERNEL_H___ 00012 #define _CONSTKERNEL_H___ 00013 00014 #include "lib/Mathematics.h" 00015 #include "lib/common.h" 00016 #include "kernel/Kernel.h" 00017 #include "features/Features.h" 00018 00019 namespace shogun 00020 { 00027 class CConstKernel: public CKernel 00028 { 00029 public: 00034 CConstKernel(float64_t c); 00035 00042 CConstKernel(CFeatures* l, CFeatures *r, float64_t c); 00043 00044 virtual ~CConstKernel(); 00045 00052 virtual bool init(CFeatures* l, CFeatures* r); 00053 00058 inline virtual EKernelType get_kernel_type() { return K_CONST; } 00059 00064 inline virtual EFeatureType get_feature_type() 00065 { 00066 return F_ANY; 00067 } 00068 00073 inline virtual EFeatureClass get_feature_class() 00074 { 00075 return C_ANY; 00076 } 00077 00082 virtual const char* get_name() const { return "Const"; } 00083 00084 protected: 00091 inline virtual float64_t compute(int32_t row, int32_t col) 00092 { 00093 return const_value; 00094 } 00095 00096 protected: 00098 float64_t const_value; 00099 }; 00100 } 00101 #endif /* _CONSTKERNEL_H__ */