ARCHIVE
Snapshot of
the Shogun machine learning toolbox website
as of
2013
: preserved, not maintained. The live site:
shogun-toolbox.org
SHOGUN
4.1.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
src
shogun
mathematics
linalg
ratapprox
tracesampler
NormalSampler.cpp
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
10
#include <
shogun/lib/common.h
>
11
#include <
shogun/lib/SGVector.h
>
12
#include <
shogun/mathematics/Random.h
>
13
#include <
shogun/mathematics/linalg/ratapprox/tracesampler/NormalSampler.h
>
14
15
namespace
shogun
16
{
17
18
CNormalSampler::CNormalSampler
()
19
:
CTraceSampler
()
20
{
21
SG_GCDEBUG
(
"%s created (%p)\n"
, this->
get_name
(),
this
)
22
}
23
24
CNormalSampler::CNormalSampler
(
index_t
dimension)
25
:
CTraceSampler
(dimension)
26
{
27
SG_GCDEBUG
(
"%s created (%p)\n"
, this->
get_name
(),
this
)
28
}
29
30
CNormalSampler::~CNormalSampler
()
31
{
32
SG_GCDEBUG
(
"%s destroyed (%p)\n"
, this->
get_name
(),
this
)
33
}
34
35
void
CNormalSampler::precompute
()
36
{
37
m_num_samples
=1;
38
}
39
40
SGVector<float64_t>
CNormalSampler::sample
(
index_t
idx)
const
41
{
42
// ignore idx since it doesnt matter, all samples are independent
43
SGVector<float64_t>
s(
m_dimension
);
44
45
for
(
index_t
i=0; i<
m_dimension
; ++i)
46
s[i]=
sg_rand
->
std_normal_distrib
();
47
48
return
s;
49
}
50
51
}
shogun::CRandom::std_normal_distrib
float64_t std_normal_distrib() const
Definition:
Random.cpp:238
index_t
int32_t index_t
Definition:
common.h:62
shogun::CTraceSampler::m_dimension
index_t m_dimension
Definition:
TraceSampler.h:90
shogun::sg_rand
CRandom * sg_rand
Definition:
init.cpp:39
NormalSampler.h
SG_GCDEBUG
#define SG_GCDEBUG(...)
Definition:
SGIO.h:102
shogun::CTraceSampler::m_num_samples
index_t m_num_samples
Definition:
TraceSampler.h:93
shogun::SGVector< float64_t >
shogun::CNormalSampler::~CNormalSampler
virtual ~CNormalSampler()
Definition:
NormalSampler.cpp:30
shogun::CNormalSampler::CNormalSampler
CNormalSampler()
Definition:
NormalSampler.cpp:18
Random.h
shogun::CNormalSampler::get_name
virtual const char * get_name() const
Definition:
NormalSampler.h:46
shogun::CNormalSampler::precompute
virtual void precompute()
Definition:
NormalSampler.cpp:35
shogun
all of classes and functions are contained in the shogun namespace
Definition:
class_list.h:18
common.h
shogun::CTraceSampler
Abstract template base class that provides an interface for sampling the trace of a linear operator u...
Definition:
TraceSampler.h:23
SGVector.h
shogun::CNormalSampler::sample
virtual SGVector< float64_t > sample(index_t idx) const
Definition:
NormalSampler.cpp:40
SHOGUN
Machine Learning Toolbox - Documentation