SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HomogeneousKernelMap.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2012 Viktor Gal
8  * Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
9  */
10 
11 #ifndef _CHOMOGENEOUKERNELMAP__H__
12 #define _CHOMOGENEOUKERNELMAP__H__
13 
16 #include <shogun/lib/common.h>
17 
18 #include <stdio.h>
19 
20 namespace shogun
21 {
27  };
28 
33  };
34 
54  class CHomogeneousKernelMap : public CDensePreprocessor<float64_t>
55  {
56  public:
59 
69  float64_t gamma = 1.0, uint64_t order = 1, float64_t period = -1);
70 
72  virtual ~CHomogeneousKernelMap();
73 
75  virtual bool init(CFeatures* features);
76 
78  virtual void cleanup();
79 
85 
91 
93  virtual const char* get_name() const { return "HomogeneousKernelMap"; }
94 
97 
106 
115 
119  void set_gamma(float64_t g);
123  float64_t get_gamma(float64_t g) const;
124 
128  void set_order(uint64_t o);
132  uint64_t get_order() const;
133 
137  void set_period(float64_t p);
141  float64_t get_period() const;
142 
143  private:
144  void init ();
145  void register_params ();
146  inline float64_t get_smooth_spectrum (float64_t omega) const;
147  inline float64_t sinc (float64_t x) const;
148  inline float64_t get_spectrum (float64_t omega) const;
149  SGVector<float64_t> apply_to_vector(const SGVector<float64_t>& in_v) const;
150 
151  private:
152  HomogeneousKernelType m_kernel;
154  float64_t m_gamma;
155  float64_t m_period;
156  uint64_t m_numSubdivisions;
157  float64_t m_subdivision;
158  uint64_t m_order;
159  int64_t m_minExponent;
160  int64_t m_maxExponent;
161  SGVector<float64_t> m_table;
162  };
163 }
164 #endif /* _CHOMOGENEOUKERNELMAP__H__ */

SHOGUN Machine Learning Toolbox - Documentation