sample.hpp
Go to the documentation of this file.
1 #ifndef STAN_MCMC_SAMPLE_HPP
2 #define STAN_MCMC_SAMPLE_HPP
3 
4 #include <Eigen/Dense>
5 #include <vector>
6 #include <string>
7 
8 namespace stan {
9 
10  namespace mcmc {
11 
12  class sample {
13  public:
14  sample(const Eigen::VectorXd& q, double log_prob, double stat)
15  : cont_params_(q), log_prob_(log_prob), accept_stat_(stat) {
16  }
17 
18  virtual ~sample() {} // No-op
19 
20  int size_cont() const {
21  return cont_params_.size();
22  }
23 
24  double cont_params(int k) const {
25  return cont_params_(k);
26  }
27 
28  void cont_params(Eigen::VectorXd& x) const {
29  x = cont_params_;
30  }
31 
32  const Eigen::VectorXd& cont_params() const {
33  return cont_params_;
34  }
35 
36  inline double log_prob() const {
37  return log_prob_;
38  }
39 
40  inline double accept_stat() const {
41  return accept_stat_;
42  }
43 
44  static void get_sample_param_names(std::vector<std::string>& names) {
45  names.push_back("lp__");
46  names.push_back("accept_stat__");
47  }
48 
49  void get_sample_params(std::vector<double>& values) {
50  values.push_back(log_prob_);
51  values.push_back(accept_stat_);
52  }
53 
54  private:
55  Eigen::VectorXd cont_params_; // Continuous coordinates of sample
56  double log_prob_; // Log probability of sample
57  double accept_stat_; // Acceptance statistic of transition
58  };
59 
60  } // mcmc
61 
62 } // stan
63 
64 #endif
65 
Eigen::VectorXd cont_params_
Definition: sample.hpp:55
double accept_stat_
Definition: sample.hpp:57
static void get_sample_param_names(std::vector< std::string > &names)
Definition: sample.hpp:44
double accept_stat() const
Definition: sample.hpp:40
virtual ~sample()
Definition: sample.hpp:18
int size_cont() const
Definition: sample.hpp:20
double log_prob() const
Definition: sample.hpp:36
void get_sample_params(std::vector< double > &values)
Definition: sample.hpp:49
const Eigen::VectorXd & cont_params() const
Definition: sample.hpp:32
double log_prob_
Definition: sample.hpp:56
sample(const Eigen::VectorXd &q, double log_prob, double stat)
Definition: sample.hpp:14
double cont_params(int k) const
Definition: sample.hpp:24
void cont_params(Eigen::VectorXd &x) const
Definition: sample.hpp:28