SHOGUN
v3.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
mathematics
linalg
ratapprox
tracesampler
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
:
27
CTraceSampler
()
28
:
CSGObject
()
29
{
30
init();
31
32
SG_GCDEBUG
(
"%s created (%p)\n"
, this->
get_name
(),
this
)
33
}
34
40
CTraceSampler
(
index_t
dimension)
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
:
90
index_t
m_dimension
;
91
93
index_t
m_num_samples
;
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_
SHOGUN
Machine Learning Toolbox - Documentation