[e23e50]: src / lib / sampler / ImmutableSampler.cc Maximize Restore History

Download this file

ImmutableSampler.cc    52 lines (41 with data), 948 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <config.h>
#include <sampler/ImmutableSampler.h>
//Needed for name
#include <sampler/ImmutableSampleMethod.h>
//Needed for nchain
#include <sampler/GraphView.h>
using std::vector;
using std::string;
namespace jags {
ImmutableSampler::ImmutableSampler(GraphView *gv,
ImmutableSampleMethod *method,
std::string const &name)
: Sampler(gv), _method(method), _nchain(nchain(gv)), _name(name)
{
}
ImmutableSampler::~ImmutableSampler()
{
delete _method;
}
void ImmutableSampler::update(vector<RNG*> const &rngs)
{
for (unsigned int ch = 0; ch < _nchain; ++ch) {
_method->update(ch, rngs[ch]);
}
}
bool ImmutableSampler::isAdaptive() const
{
return false;
}
void ImmutableSampler::adaptOff()
{
}
bool ImmutableSampler::checkAdaptation() const
{
return true;
}
string ImmutableSampler::name() const
{
return _name;
}
}