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-2008 Soeren Sonnenburg
00008  * Copyright (C) 1999-2008 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 
00025 class CConstKernel: public CKernel
00026 {
00027     public:
00032         CConstKernel(DREAL c);
00033 
00040         CConstKernel(CFeatures* l, CFeatures *r, DREAL c);
00041 
00042         virtual ~CConstKernel();
00043 
00050         virtual bool init(CFeatures* l, CFeatures* r);
00051 
00057         virtual bool load_init(FILE* src);
00058 
00064         virtual bool save_init(FILE* dest);
00065 
00070         inline virtual EKernelType get_kernel_type() { return K_CONST; }
00071 
00076         inline virtual EFeatureType get_feature_type()
00077         {
00078             return F_ANY;
00079         }
00080 
00085         inline virtual EFeatureClass get_feature_class()
00086         {
00087             return C_ANY;
00088         }
00089 
00094         virtual const CHAR* get_name() { return "Const"; }
00095 
00096     protected:
00103         inline virtual DREAL compute(INT row, INT col)
00104         {
00105             return const_value;
00106         }
00107 
00108     protected:
00110         DREAL const_value;
00111 };
00112 
00113 #endif /* _CONSTKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation