9 #include <configure.hpp>
15 #include <athena/hydro/hydro.hpp>
16 #include <athena/mesh/mesh.hpp>
19 #include <application/application.hpp>
26 Application::Logger app(
"inversion");
27 app->Log(
"MCMC move");
34 std::stringstream msg;
36 app->Error(
"mcmc chain uninitialized");
43 for (
int k = 0; k < nwalker; ++k) {
62 unsigned int seed =
time(NULL);
63 for (
int k = 0; k < nwalker; ++k) {
65 pdiff = (ndim - 1.) * log(
zz_[k]) + lnp1 - lnp0;
67 if (pdiff > log(1. * rand_r(&seed) / RAND_MAX)) {
68 for (
int d = 0; d < ndim; ++d)
recs_.
par[cur][k][d] =
par_[d];
80 for (
int n = 0; n < NHYDRO; ++n)
82 for (
int i = is; i <= ie; ++i) {
83 phydro->w1(n, ks + k,
j, i) = phydro->w(n, ks + k,
j, i);
86 for (
int d = 0; d < ndim; ++d)
88 for (
int d = 0; d < nval; ++d)
94 for (
int n = 0; n < NHYDRO; ++n)
96 for (
int i = is; i <= ie; ++i) {
97 phydro->w(n, ks + k,
j, i) = phydro->w1(n, ks + k,
j, i);
void MCMCSave(Hydro *phydro)
void MCMCInit(Radiation *prad, Hydro *phydro)
virtual Real LogPosteriorProbability(Radiation *prad, Hydro *phydro, Real const *par, Real *val, int k) const
void MCMCMove(Radiation *prad, Hydro *phydro)
MeshBlock const * pmy_block_
pointer to parent MeshBlock
void mcmc_report(mcmc_opts *opts, mcmc_recs *recs, char const *mode)
double mcmc_stretch_move(double *newp, double **oldp, int iwalker, int nwalker, int ndim, mcmc_opts *opts)
This file contains data structure and subroutines implementing Markov Chain Monte Carlo sampler.