SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TraceSampler.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) 2013 Soumyajit De
8  */
9 #ifndef TRACE_SAMPLER_H_
10 #define TRACE_SAMPLER_H_
11 
12 #include <shogun/lib/config.h>
13 #include <shogun/base/SGObject.h>
14 #include <shogun/base/Parameter.h>
15 
16 namespace shogun
17 {
18 template<class T> class SGVector;
19 
23 class CTraceSampler : public CSGObject
24 {
25 public:
28  : CSGObject()
29  {
30  init();
31 
32  SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
33  }
34 
41  : CSGObject()
42  {
43  init();
44 
45  m_dimension=dimension;
46 
47  SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
48  }
49 
51  virtual ~CTraceSampler()
52  {
53  SG_GCDEBUG("%s destroyed (%p)\n", this->get_name(), this)
54  }
55 
62  virtual SGVector<float64_t> sample(index_t idx) const = 0;
63 
68  virtual void precompute() = 0;
69 
71  virtual const index_t get_num_samples() const
72  {
73  return m_num_samples;
74  }
75 
77  virtual const index_t get_dimension() const
78  {
79  return m_dimension;
80  }
81 
83  virtual const char* get_name() const
84  {
85  return "TraceSampler";
86  }
87 
88 protected:
91 
94 
95 private:
97  void init()
98  {
99  m_num_samples=0;
100  m_dimension=0;
101 
102  SG_ADD(&m_num_samples, "num_samples",
103  "Number of samples this sampler can generate", MS_NOT_AVAILABLE);
104 
105  SG_ADD(&m_dimension, "sample_dimension",
106  "Dimension of samples this sampler can generate", MS_NOT_AVAILABLE);
107  }
108 };
109 
110 }
111 
112 #endif // TRACE_SAMPLER_H_
virtual const index_t get_dimension() const
Definition: TraceSampler.h:77
int32_t index_t
Definition: common.h:62
virtual SGVector< float64_t > sample(index_t idx) const =0
CTraceSampler(index_t dimension)
Definition: TraceSampler.h:40
virtual const index_t get_num_samples() const
Definition: TraceSampler.h:71
virtual void precompute()=0
#define SG_GCDEBUG(...)
Definition: SGIO.h:102
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:112
virtual const char * get_name() const
Definition: TraceSampler.h:83
virtual ~CTraceSampler()
Definition: TraceSampler.h:51
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
Abstract template base class that provides an interface for sampling the trace of a linear operator u...
Definition: TraceSampler.h:23
#define SG_ADD(...)
Definition: SGObject.h:81

SHOGUN Machine Learning Toolbox - Documentation