#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <configure.hpp>
#include <climath/core.h>
#include <utils/ndarrays.hpp>
#include "mcmc.hpp"
Go to the source code of this file.
|
void | _choldc (double **a, int n, double *p) |
|
int | _acor (double *mean, double *sigma, double *tau, double *X, int L) |
|
void | mcmc_alloc (mcmc_recs *recs, int nstep, int nwalker, int ndim, int nvalue) |
|
void | mcmc_free (mcmc_recs *recs) |
|
void | mcmc_statistics (double *mean, double *sigma, double *tau, mcmc_recs *recs) |
|
void | mcmc_save_fits (char const *fname, mcmc_opts *opts, mcmc_recs *recs, int include_last) |
|
void | mcmc_load_fits (char const *fname, mcmc_opts *opts, mcmc_recs *recs, int alloc) |
|
void | mcmc_append_recs (mcmc_recs *dst, mcmc_recs *src) |
|
void | mcmc_report (mcmc_opts *opts, mcmc_recs *recs, char const *mode) |
|
void | mcmc_init (ObjectiveFunction_t lnprob, double **par, mcmc_opts *opts, mcmc_recs *recs, void *obj) |
|
void | mcmc_advance (ObjectiveFunction_t lnprob, mcmc_opts *opts, mcmc_recs *recs, void *obj) |
|
double | mcmc_stretch_move (double *newp, double **oldp, int iwalker, int nwalker, int ndim, mcmc_opts *opts) |
|
void | mcmc_walk_move (double *newp, double **oldp, int k, int nwalker, int np, mcmc_opts *opts) |
|
◆ TAUMAX
◆ WINMULT
◆ MAXLAG
◆ MINFAC
◆ _choldc()
void _choldc |
( |
double ** |
a, |
|
|
int |
n, |
|
|
double * |
p |
|
) |
| |
Given a positive definite symmetric matrix a[0..n-1][0..n-1], this subroutine constructs its Cholesky decomposition: A = L*L'. On input, only the upper triangle of A need be given; it is not modified. The Cholesky factor L is returned in the lower triangle of A, except for its diagonal elements which are returned in p[0..n-1]. see Numerical Recipes in C, pg 97
Definition at line 27 of file mcmc.cpp.
◆ _acor()
int _acor |
( |
double * |
mean, |
|
|
double * |
sigma, |
|
|
double * |
tau, |
|
|
double * |
X, |
|
|
int |
L |
|
) |
| |
◆ mcmc_alloc()
void mcmc_alloc |
( |
mcmc_recs * |
recs, |
|
|
int |
nstep, |
|
|
int |
nwalker, |
|
|
int |
ndim, |
|
|
int |
nvalue |
|
) |
| |
allocate memory for mcmc chains
Definition at line 126 of file mcmc.cpp.
◆ mcmc_free()
◆ mcmc_statistics()
void mcmc_statistics |
( |
double * |
mean, |
|
|
double * |
sigma, |
|
|
double * |
tau, |
|
|
mcmc_recs * |
recs |
|
) |
| |
calculate autocorrelation time
Definition at line 160 of file mcmc.cpp.
◆ mcmc_save_fits()
void mcmc_save_fits |
( |
char const * |
fname, |
|
|
mcmc_opts * |
opts, |
|
|
mcmc_recs * |
recs, |
|
|
int |
include_last = false |
|
) |
| |
save mcmc chains to a FITS file
Definition at line 179 of file mcmc.cpp.
◆ mcmc_load_fits()
void mcmc_load_fits |
( |
char const * |
fname, |
|
|
mcmc_opts * |
opts, |
|
|
mcmc_recs * |
recs, |
|
|
int |
alloc = true |
|
) |
| |
load mcmc chains from a FITS file
Definition at line 379 of file mcmc.cpp.
◆ mcmc_append_recs()
copy mcmc chains
Definition at line 459 of file mcmc.cpp.
◆ mcmc_report()
◆ mcmc_init()
◆ mcmc_advance()
implement Ensemble Samplers with Affine Invariance, Goodman and Weare (2010)
- Parameters
-
lnprob | I, function calculating log probabiligy |
par | I/O, parameter vector |
val | I, measurement vector |
np | I, size of input parameter vector |
nv | I, size of measurement vector |
nwalker | I, number of walkers |
nstep | I, number of steps |
opts | I, mcmc options |
recs | O, mcmc chains |
Definition at line 738 of file mcmc.cpp.
◆ mcmc_stretch_move()
double mcmc_stretch_move |
( |
double * |
newp, |
|
|
double ** |
oldp, |
|
|
int |
iwalker, |
|
|
int |
nwalker, |
|
|
int |
ndim, |
|
|
mcmc_opts * |
opts |
|
) |
| |
◆ mcmc_walk_move()
void mcmc_walk_move |
( |
double * |
newp, |
|
|
double ** |
oldp, |
|
|
int |
k, |
|
|
int |
nwalker, |
|
|
int |
np, |
|
|
mcmc_opts * |
opts |
|
) |
| |