ConstKernel.h

Go to the documentation of this file.
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 <shogun/mathematics/Math.h>
00015 #include <shogun/lib/common.h>
00016 #include <shogun/kernel/Kernel.h>
00017 #include <shogun/features/Features.h>
00018 
00019 namespace shogun
00020 {
00027 class CConstKernel: public CKernel
00028 {
00029     public:
00031         CConstKernel();
00032 
00037         CConstKernel(float64_t c);
00038 
00045         CConstKernel(CFeatures* l, CFeatures *r, float64_t c);
00046 
00047         virtual ~CConstKernel();
00048 
00055         virtual bool init(CFeatures* l, CFeatures* r);
00056 
00061         inline virtual EKernelType get_kernel_type() { return K_CONST; }
00062 
00067         inline virtual EFeatureType get_feature_type()
00068         {
00069             return F_ANY;
00070         }
00071 
00076         inline virtual EFeatureClass get_feature_class()
00077         {
00078             return C_ANY;
00079         }
00080 
00085         virtual const char* get_name() const { return "ConstKernel"; }
00086 
00087     protected:
00094         inline virtual float64_t compute(int32_t row, int32_t col)
00095         {
00096             return const_value;
00097         }
00098 
00099     private:
00100         void init();
00101 
00102     protected:
00104         float64_t const_value;
00105 };
00106 }
00107 #endif /* _CONSTKERNEL_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation