1 #ifndef STAN_MCMC_HMC_HAMILTONIANS_BASE_HAMILTONIAN_HPP 2 #define STAN_MCMC_HMC_HAMILTONIANS_BASE_HAMILTONIAN_HPP 16 template <
class Model,
class Po
int,
class BaseRNG>
26 virtual double T(Point& z) = 0;
32 virtual double tau(Point& z) = 0;
34 virtual double phi(Point& z) = 0;
47 virtual Eigen::VectorXd
dtau_dq(
52 virtual Eigen::VectorXd
dtau_dp(Point& z) = 0;
55 virtual Eigen::VectorXd
dphi_dq(
60 virtual void sample_p(Point& z, BaseRNG& rng) = 0;
73 z.V = -stan::model::log_prob_propto<true>(
model_, z.q);
74 }
catch (
const std::exception& e) {
76 z.V = std::numeric_limits<double>::infinity();
87 }
catch (
const std::exception& e) {
89 z.V = std::numeric_limits<double>::infinity();
116 writer(
"Informational Message: The current Metropolis proposal " 117 "is about to be rejected because of the following issue:");
119 writer(
"If this warning occurs sporadically, such as for highly " 120 "constrained variable types like covariance matrices, then " 121 "the sampler is fine,");
122 writer(
"but if this warning occurs often then your model may be " 123 "either severely ill-conditioned or misspecified.");
virtual double T(Point &z)=0
Probability, optimization and sampling library.
virtual Eigen::VectorXd dtau_dp(Point &z)=0
void write_error_msg_(const std::exception &e, interface_callbacks::writer::base_writer &writer)
virtual double tau(Point &z)=0
void update_metric_gradient(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
void gradient(const M &model, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, double &f, Eigen::Matrix< double, Eigen::Dynamic, 1 > &grad_f, std::ostream *msgs=0)
virtual double phi(Point &z)=0
void update_gradients(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
void update_potential_gradient(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
virtual Eigen::VectorXd dphi_dq(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)=0
virtual void sample_p(Point &z, BaseRNG &rng)=0
base_writer is an abstract base class defining the interface for Stan writer callbacks.
virtual double dG_dt(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)=0
void update_metric(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
void update_potential(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
base_hamiltonian(const Model &model)
void init(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
virtual Eigen::VectorXd dtau_dq(Point &z, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)=0