Stan  2.10.0
probability, sampling & optimization
init_xhmc.hpp
Go to the documentation of this file.
1 #ifndef STAN_SERVICES_SAMPLE_INIT_XHMC_HPP
2 #define STAN_SERVICES_SAMPLE_INIT_XHMC_HPP
3 
8 
9 namespace stan {
10  namespace services {
11  namespace sample {
12 
13  template<class Sampler>
15  stan::services::argument* algorithm) {
18  (algorithm->arg("hmc"));
19 
22  (algorithm->arg("hmc")->arg("engine")->arg("xhmc"));
23 
24  double epsilon = dynamic_cast<stan::services::real_argument*>
25  (hmc->arg("stepsize"))->value();
26  double epsilon_jitter
27  = dynamic_cast<stan::services::real_argument*>
28  (hmc->arg("stepsize_jitter"))->value();
29  int max_depth
30  = dynamic_cast<stan::services::int_argument*>
31  (base->arg("max_depth"))->value();
32  double x_delta
33  = dynamic_cast<stan::services::real_argument*>
34  (base->arg("x_delta"))->value();
35 
36  dynamic_cast<Sampler*>(sampler)->set_nominal_stepsize(epsilon);
37  dynamic_cast<Sampler*>(sampler)->set_stepsize_jitter(epsilon_jitter);
38  dynamic_cast<Sampler*>(sampler)->set_max_depth(max_depth);
39  dynamic_cast<Sampler*>(sampler)->set_x_delta(x_delta);
40 
41  return true;
42  }
43  }
44  }
45 }
46 
47 #endif
void sample(stan::mcmc::base_mcmc *sampler, int num_warmup, int num_samples, int num_thin, int refresh, bool save, stan::services::sample::mcmc_writer< Model, SampleRecorder, DiagnosticRecorder, MessageRecorder > &mcmc_writer, stan::mcmc::sample &init_s, Model &model, RNG &base_rng, const std::string &prefix, const std::string &suffix, std::ostream &o, StartTransitionCallback &callback, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
Definition: sample.hpp:17
Probability, optimization and sampling library.
bool init_xhmc(stan::mcmc::base_mcmc *sampler, stan::services::argument *algorithm)
Definition: init_xhmc.hpp:14
virtual argument * arg(const std::string &name)
Definition: argument.hpp:74
argument * arg(const std::string &name)

     [ Stan Home Page ] © 2011–2016, Stan Development Team.