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 Siddharth Kherada 00008 * Copyright (C) 2007-2011 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _WAVELETKERNEL_H___ 00012 #define _WAVELETKERNEL_H___ 00013 00014 #include <shogun/lib/common.h> 00015 #include <shogun/kernel/DotKernel.h> 00016 #include <shogun/features/DotFeatures.h> 00017 00018 namespace shogun 00019 { 00035 class CWaveletKernel: public CDotKernel 00036 { 00037 public: 00039 CWaveletKernel(); 00040 00047 CWaveletKernel(int32_t size, float64_t Wdilation, float64_t Wtranslation); 00048 00057 CWaveletKernel(CDotFeatures* l, CDotFeatures* r, int32_t size,float64_t Wdilation, float64_t Wtranslation); 00058 00059 virtual ~CWaveletKernel(); 00060 00067 virtual bool init(CFeatures* l, CFeatures* r); 00068 00069 virtual void cleanup(); 00070 00075 virtual EKernelType get_kernel_type() { return K_WAVELET; } 00076 00081 virtual const char* get_name() const { return "WaveletKernel"; } 00082 00083 protected: 00092 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00093 00094 protected: 00096 inline float64_t MotherWavelet(float64_t h) 00097 { 00098 return cos(1.75*h)*exp(-h*h/2); 00099 } 00100 00101 private: 00102 void init(); 00103 00104 protected: 00106 float64_t Wdilation; 00108 float64_t Wtranslation; 00109 }; 00110 } 00111 #endif /* _WAVELETKERNEL_H__ */