1 #ifndef MUTABLE_SAMPLER_H_ 2 #define MUTABLE_SAMPLER_H_ 3 4 #include <sampler/Sampler.h> 5 6 namespace jags { 7 8 struct RNG; 9 class MutableSampleMethod; 10 11 /** 12 * @short Samples multiple chains in parallel 13 * 14 * A vector of MutableSampleMethod objects is used to update each 15 * chain in parallel. 16 */ 17 class MutableSampler : public Sampler 18 { 19 std::vector<MutableSampleMethod*> _methods; 20 const std::string _name; 21 public: 22 /** 23 * Constructor. 24 * 25 * @param gv View of the sample graph, passed directly to the 26 * parent class Sampler, which takes ownership of it 27 * 28 * @param methods Vector of pointers to MutableSampleMethod 29 * objects, of length equal to the number of chains. These 30 * must be dynamically allocated, as the 31 * MutableSampler will take ownership of them, and 32 * will delete them when its destructor is called 33 * 34 * @param name The name of the sampler, which will be returned 35 * by the member function name. 36 */ 37 MutableSampler(GraphView *gv, 38 std::vector<MutableSampleMethod*> const &methods, 39 std::string const &name); 40 ~MutableSampler(); 41 void update(std::vector<RNG*> const &rngs); 42 bool isAdaptive() const; 43 void adaptOff(); 44 bool checkAdaptation() const; 45 /** 46 * Returns the name of the sampler, as given to the constructor 47 */ 48 std::string name() const; 49 }; 50 51 } /* namespace jags */ 52 53 #endif /* MUTABLE_SAMPLER_H_ */ 54