Classes | Functions
stan::mcmc Namespace Reference

Classes

class  adapt_dense_e_nuts
 
class  adapt_dense_e_nuts_classic
 
class  adapt_dense_e_static_hmc
 
class  adapt_dense_e_static_uniform
 
class  adapt_dense_e_xhmc
 
class  adapt_diag_e_nuts
 
class  adapt_diag_e_nuts_classic
 
class  adapt_diag_e_static_hmc
 
class  adapt_diag_e_static_uniform
 
class  adapt_diag_e_xhmc
 
class  adapt_softabs_nuts
 
class  adapt_softabs_static_hmc
 
class  adapt_softabs_static_uniform
 
class  adapt_softabs_xhmc
 
class  adapt_unit_e_nuts
 
class  adapt_unit_e_nuts_classic
 
class  adapt_unit_e_static_hmc
 
class  adapt_unit_e_static_uniform
 
class  adapt_unit_e_xhmc
 
class  base_adaptation
 
class  base_adapter
 
class  base_hamiltonian
 
class  base_hmc
 
class  base_integrator
 
class  base_leapfrog
 
class  base_mcmc
 
class  base_nuts
 
class  base_nuts_classic
 
class  base_static_hmc
 
class  base_static_uniform
 
class  base_xhmc
 
class  chains
 
class  covar_adaptation
 
class  dense_e_metric
 
class  dense_e_nuts
 
class  dense_e_nuts_classic
 
class  dense_e_point
 
class  dense_e_static_hmc
 
class  dense_e_static_uniform
 
class  dense_e_xhmc
 
class  diag_e_metric
 
class  diag_e_nuts
 
class  diag_e_nuts_classic
 
class  diag_e_point
 
class  diag_e_static_hmc
 
class  diag_e_static_uniform
 
class  diag_e_xhmc
 
class  divergent_hamiltonian
 
class  divergent_nuts
 
class  divergent_nuts_classic
 
class  divergent_xhmc
 
class  expl_leapfrog
 
class  fixed_param_sampler
 
class  impl_leapfrog
 
class  mock_hamiltonian
 
class  mock_hmc
 
class  mock_integrator
 
class  mock_model
 
class  mock_nuts
 
class  mock_nuts_classic
 
class  mock_static_hmc
 
class  mock_static_uniform
 
class  mock_xhmc
 
struct  nuts_util
 
class  ps_point
 
class  ps_point_test
 
class  rho_inspector_mock_nuts
 
class  sample
 
struct  softabs_fun
 
class  softabs_metric
 
class  softabs_nuts
 
class  softabs_point
 
class  softabs_static_hmc
 
class  softabs_static_uniform
 
class  softabs_xhmc
 
class  stepsize_adaptation
 
class  stepsize_adapter
 
class  stepsize_covar_adapter
 
class  stepsize_var_adapter
 
class  unit_e_metric
 
class  unit_e_nuts
 
class  unit_e_nuts_classic
 
class  unit_e_point
 
class  unit_e_static_hmc
 
class  unit_e_static_uniform
 
class  unit_e_xhmc
 
class  var_adaptation
 
class  windowed_adaptation
 

Functions

void write_metric (stan::callbacks::writer &writer)
 
void stable_sum (double a1, double log_w1, double a2, double log_w2, double &sum_a, double &log_sum_w)
 
 TEST (psPoint, fastVectorCopy)
 
 TEST (psPoint, fastMatrixCopy)
 
 TEST (psPoint, write_metric_streams)
 

Function Documentation

void stan::mcmc::stable_sum ( double  a1,
double  log_w1,
double  a2,
double  log_w2,
double &  sum_a,
double &  log_sum_w 
)

a1 and a2 are running averages of the form $ a1 = ( \sum_{n \in N1} w_{n} f_{n} ) / ( \sum_{n \in N1} w_{n} ) $ $ a2 = ( \sum_{n \in N2} w_{n} f_{n} ) / ( \sum_{n \in N2} w_{n} ) $ and the weights are the respective normalizing constants $ w1 = \sum_{n \in N1} w_{n} $ $ w2 = \sum_{n \in N2} w_{n}. $

This function returns the pooled average $ sum_a = ( \sum_{n \in N1 \cup N2} w_{n} f_{n} ) / ( \sum_{n \in N1 \cup N2} w_{n} ) $ and the pooled weights $ log_sum_w = log(w1 + w2). $

Parameters
a1First running average, f1 / w1
log_w1Log of first summed weight
a2Second running average
log_w2Log of second summed weight
sum_aAverage of input running averages
log_sum_wLog of summed input weights

Definition at line 39 of file base_xhmc.hpp.

References a2, e, stan::math::exp(), and test_ParserArtEvents::log.

Referenced by stan::mcmc::base_xhmc< Model, diag_e_metric, expl_leapfrog, BaseRNG >::build_tree(), and stan::mcmc::base_xhmc< Model, diag_e_metric, expl_leapfrog, BaseRNG >::transition().

40  {
41  if (log_w2 > log_w1) {
42  double e = std::exp(log_w1 - log_w2);
43  sum_a = (e * a1 + a2) / (1 + e);
44  log_sum_w = log_w2 + std::log(1 + e);
45  } else {
46  double e = std::exp(log_w2 - log_w1);
47  sum_a = (a1 + e * a2) / (1 + e);
48  log_sum_w = log_w1 + std::log(1 + e);
49  }
50  }
TH1F * a2
Definition: f2_nu.C:545
TH1F * a1
Definition: f2_nu.C:476
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
Float_t e
Definition: plot.C:35
stan::mcmc::TEST ( psPoint  ,
fastVectorCopy   
)

Definition at line 54 of file ps_point_test.cpp.

References stan::mcmc::ps_point_test::fast_vector_copy().

54  {
55  ps_point_test::fast_vector_copy();
56  }
stan::mcmc::TEST ( psPoint  ,
fastMatrixCopy   
)

Definition at line 58 of file ps_point_test.cpp.

References stan::mcmc::ps_point_test::fast_matrix_copy().

58  {
59  ps_point_test::fast_matrix_copy();
60  }
stan::mcmc::TEST ( psPoint  ,
write_metric_streams   
)

Definition at line 62 of file ps_point_test.cpp.

References stan::test::capture_std_streams(), stan::test::cerr_ss, stan::test::cout_ss, confusionMatrixTree::out, stan::test::reset_std_streams(), runNovaSAM::str, and stan::mcmc::ps_point::write_metric().

62  {
64 
65  ps_point point(2);
66  std::stringstream out;
68  EXPECT_NO_THROW(point.write_metric(writer));
69  EXPECT_EQ("", out.str());
70 
72  EXPECT_EQ("", stan::test::cout_ss.str());
73  EXPECT_EQ("", stan::test::cerr_ss.str());
74  }
void reset_std_streams()
Definition: util.hpp:47
void capture_std_streams()
Definition: util.hpp:36
std::stringstream cerr_ss
Definition: util.hpp:34
std::stringstream cout_ss
Definition: util.hpp:33
void stan::mcmc::write_metric ( stan::callbacks::writer writer)
inline

Definition at line 18 of file unit_e_point.hpp.

18  {
19  writer("No free parameters for unit metric");
20  }