#include <config.h>
#include <sampler/GibbsSampler.h>
#include <graph/StochasticNode.h>
#include <vector>
#include <set>
#include <Rmath.h>
using std::vector;
using std::set;
GibbsSampler::GibbsSampler(StochasticNode *node,
Graph const &graph)
: Sampler(vector<StochasticNode *>(1, node), graph)
{
}
void GibbsSampler::setValue(double const *value, unsigned long length)
{
nodes().front()->data.setValue(value, length);
vector<Node*> const &dc = deterministicChildren();
for (vector<Node*>::const_iterator i(dc.begin()); i != dc.end(); ++i) {
(*i)->forwardSample();
}
}
StochasticNode *GibbsSampler::node()
{
return nodes().front();
}
syntax highlighted by Code2HTML, v. 0.9.1