APEMoST
|
#include "mcmc.h"
#include "gsl_helper.h"
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_sf.h>
Defines | |
#define | N_PARAMETERS |
#define | get_n_par(m) N_PARAMETERS |
#define | PROPOSAL |
Functions | |
unsigned long | get_params_accepts_sum (const mcmc *m) |
unsigned long | get_params_rejects_sum (const mcmc *m) |
unsigned long | get_params_accepts_for (const mcmc *m, const unsigned int i) |
unsigned long | get_params_rejects_for (const mcmc *m, const unsigned int i) |
double | get_accept_rate_for (const mcmc *m, const unsigned int i) |
unsigned long | get_params_accepts_global (const mcmc *m) |
unsigned long | get_params_rejects_global (const mcmc *m) |
double | get_accept_rate_global (const mcmc *m) |
gsl_vector * | get_vector_from_array (const unsigned long *array, const unsigned int size) |
gsl_vector * | get_accept_rate (const mcmc *m) |
const char ** | get_params_descr (const mcmc *m) |
void | inc_params_accepts_for (mcmc *m, const unsigned int i) |
void | inc_params_rejects_for (mcmc *m, const unsigned int i) |
void | inc_params_accepts (mcmc *m) |
void | inc_params_rejects (mcmc *m) |
void | set_params_accepts_for (mcmc *m, const long new_params_accept, const unsigned int i) |
void | set_params_rejects_for (mcmc *m, const long new_params_reject, const unsigned int i) |
void | reset_accept_rejects (mcmc *m) |
void | set_prob_best (mcmc *m, const double new_prob_best) |
double | get_prob (const mcmc *m) |
double | get_prior (const mcmc *m) |
double | get_prob_best (const mcmc *m) |
void | set_minmax_for (mcmc *m, const double new_min, const double new_max, const unsigned int i) |
void | set_steps_for (mcmc *m, const double new_step, const unsigned int i) |
void | set_steps_for_normalized (mcmc *m, const double new_step, const unsigned int i) |
void | set_params_best (mcmc *m, const gsl_vector *new_params_best) |
void | set_params_for (mcmc *m, const double new_param, const unsigned int i) |
gsl_vector * | get_params (const mcmc *m) |
double | get_params_for (const mcmc *m, const unsigned int i) |
gsl_vector * | get_params_min (const mcmc *m) |
double | get_params_min_for (const mcmc *m, const unsigned int i) |
gsl_vector * | get_params_max (const mcmc *m) |
double | get_params_max_for (const mcmc *m, const unsigned int i) |
gsl_vector * | get_params_best (const mcmc *m) |
double | get_params_best_for (const mcmc *m, const unsigned int i) |
void | set_params (mcmc *m, gsl_vector *new_params) |
void | set_params_descr_all (mcmc *m, const char **new_par_descr) |
void | set_params_descr_for (mcmc *m, const char *new_par_descr, const unsigned int i) |
gsl_rng * | get_random (const mcmc *m) |
void | set_random (mcmc *m, gsl_rng *newrandom) |
void | set_prob (mcmc *m, const double new_prob) |
void | set_prior (mcmc *m, const double new_prior) |
const gsl_matrix * | get_data (const mcmc *m) |
void | set_data (mcmc *m, const gsl_matrix *new_data) |
gsl_vector * | get_steps (const mcmc *m) |
double | get_steps_for (const mcmc *m, const unsigned int i) |
double | get_steps_for_normalized (const mcmc *m, const unsigned int i) |
void | free_gsl_vector_array (gsl_vector **arr) |
void | set_steps_all (mcmc *m, const double *new_steps) |
double | get_next_uniform_plusminus_random (const mcmc *m) |
double | get_next_uniform_random (const mcmc *m) |
double | get_next_random_jump (const mcmc *m, const double sigma) |
double | get_next_alog_urandom (const mcmc *m) |
#define get_n_par | ( | m | ) | N_PARAMETERS |
#define N_PARAMETERS |
Fix the number of parameters to the given value
Setting this might leads the compiler to more optimization. If in doubt, do not set, as your program then can be used for any problems regardless of number of parameters.
my favorite trick: automatically count the lines in the current file CCFLAGS="-DN_PARAMETERS="$(cat params|wc -l)"
Referenced by check().
#define PROPOSAL |
void free_gsl_vector_array | ( | gsl_vector ** | arr | ) |
gsl_vector* get_accept_rate | ( | const mcmc * | m | ) |
References get_n_par, get_vector_from_array(), mcmc::params_accepts, mcmc::params_rejects, and r.
Referenced by markov_chain_calibrate_orig().
double get_accept_rate_for | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
References get_params_accepts_for(), and get_params_rejects_for().
double get_accept_rate_global | ( | const mcmc * | m | ) |
References get_params_accepts_global(), and get_params_rejects_global().
Referenced by markov_chain_calibrate_orig().
const gsl_matrix* get_data | ( | const mcmc * | m | ) |
References mcmc::data.
double get_next_alog_urandom | ( | const mcmc * | m | ) |
get next random number (logarithmic uniformly distributed between -inf and 0)
References get_next_uniform_random().
Referenced by test_random().
double get_next_random_jump | ( | const mcmc * | m, |
const double | sigma | ||
) |
get next random number (distributed by the proposal distribution)
You can choose a proposal distribution. The default is a gaussian distribution.
Set PROPOSAL_LOGISTIC, PROPOSAL_UNIFORM if you want to use a different proposal distribution.
References get_random().
Referenced by do_step_for().
double get_next_uniform_plusminus_random | ( | const mcmc * | m | ) |
get next random number (uniformly distributed between -1 and 1)
References get_next_uniform_random().
double get_next_uniform_random | ( | const mcmc * | m | ) |
get next random number (uniformly distributed between 0 and 1)
References get_random().
Referenced by get_next_alog_urandom(), get_next_uniform_plusminus_random(), parallel_tempering_decide_swap_now(), parallel_tempering_decide_swap_random(), rmw_adapt_stepwidth(), and test_random().
gsl_vector* get_params | ( | const mcmc * | m | ) |
References mcmc::params.
Referenced by burn_in(), dump(), main(), markov_chain_calibrate_alt(), markov_chain_calibrate_orig(), print_current_positions(), and read_calibration_file().
unsigned long get_params_accepts_for | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params_accepts.
Referenced by assess_acceptance_rate(), and get_accept_rate_for().
unsigned long get_params_accepts_global | ( | const mcmc * | m | ) |
References mcmc::accept.
Referenced by assess_acceptance_rate(), dump(), and get_accept_rate_global().
unsigned long get_params_accepts_sum | ( | const mcmc * | m | ) |
References get_n_par, and mcmc::params_accepts.
Referenced by adapt().
gsl_vector* get_params_best | ( | const mcmc * | m | ) |
References mcmc::params_best.
Referenced by calibrate_rest(), print_current_positions(), restart_from_best(), and write_params_file().
double get_params_best_for | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params_best.
const char** get_params_descr | ( | const mcmc * | m | ) |
References mcmc::params_descr.
Referenced by analyse_marginal_distributions(), calc_marginal_distribution(), markov_chain_calibrate_orig(), and write_params_file().
double get_params_for | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params.
Referenced by calc_model(), and write_calibrations_file().
gsl_vector* get_params_max | ( | const mcmc * | m | ) |
References mcmc::params_max.
Referenced by calc_beta_0(), and write_params_file().
double get_params_max_for | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params_max.
Referenced by calc_marginal_distribution(), get_steps_for_normalized(), main(), and set_steps_for_normalized().
gsl_vector* get_params_min | ( | const mcmc * | m | ) |
References mcmc::params_min.
Referenced by calc_beta_0(), and write_params_file().
double get_params_min_for | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params_min.
Referenced by calc_marginal_distribution(), get_steps_for_normalized(), main(), and set_steps_for_normalized().
unsigned long get_params_rejects_for | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params_rejects.
Referenced by get_accept_rate_for().
unsigned long get_params_rejects_global | ( | const mcmc * | m | ) |
References mcmc::reject.
Referenced by dump(), and get_accept_rate_global().
unsigned long get_params_rejects_sum | ( | const mcmc * | m | ) |
References get_n_par, and mcmc::params_rejects.
Referenced by adapt().
double get_prior | ( | const mcmc * | m | ) |
References mcmc::prior.
Referenced by calc_model(), main(), and run_sampler().
double get_prob | ( | const mcmc * | m | ) |
References mcmc::prob.
Referenced by adapt(), main(), markov_chain_step(), markov_chain_step_for(), print_current_positions(), rmw_adapt_stepwidth(), and run_sampler().
double get_prob_best | ( | const mcmc * | m | ) |
References mcmc::prob_best.
Referenced by print_current_positions(), and restart_from_best().
gsl_rng* get_random | ( | const mcmc * | m | ) |
References mcmc::random.
Referenced by get_next_random_jump(), get_next_uniform_random(), and markov_chain_calibrate_multilinear_regression().
gsl_vector* get_steps | ( | const mcmc * | m | ) |
double get_steps_for | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params_step.
Referenced by get_steps_for_normalized(), markov_chain_calibrate_alt(), markov_chain_calibrate_orig(), write_calibration_summary(), and write_calibrations_file().
double get_steps_for_normalized | ( | const mcmc * | m, |
const unsigned int | i | ||
) |
gsl_vector* get_vector_from_array | ( | const unsigned long * | array, |
const unsigned int | size | ||
) |
References assert.
Referenced by get_accept_rate().
void inc_params_accepts | ( | mcmc * | m | ) |
References mcmc::accept, get_n_par, and inc_params_accepts_for().
Referenced by markov_chain_step().
void inc_params_accepts_for | ( | mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params_accepts.
Referenced by inc_params_accepts(), and markov_chain_step_for().
void inc_params_rejects | ( | mcmc * | m | ) |
References get_n_par, inc_params_rejects_for(), and mcmc::reject.
Referenced by markov_chain_step().
void inc_params_rejects_for | ( | mcmc * | m, |
const unsigned int | i | ||
) |
References mcmc::params_rejects.
Referenced by inc_params_rejects(), and markov_chain_step_for().
void reset_accept_rejects | ( | mcmc * | m | ) |
restart counting
References mcmc::accept, get_n_par, mcmc::reject, set_params_accepts_for(), and set_params_rejects_for().
Referenced by adapt(), assess_acceptance_rate(), and markov_chain_calibrate_orig().
void set_data | ( | mcmc * | m, |
const gsl_matrix * | new_data | ||
) |
References mcmc::data.
Referenced by prepare_and_run_sampler().
void set_minmax_for | ( | mcmc * | m, |
const double | new_min, | ||
const double | new_max, | ||
const unsigned int | i | ||
) |
References mcmc::params_max, and mcmc::params_min.
void set_params | ( | mcmc * | m, |
gsl_vector * | new_params | ||
) |
References assert, mcmc::n_par, and mcmc::params.
Referenced by calibrate_rest(), markov_chain_step(), and restart_from_best().
void set_params_accepts_for | ( | mcmc * | m, |
const long | new_params_accept, | ||
const unsigned int | i | ||
) |
References mcmc::params_accepts.
Referenced by reset_accept_rejects().
void set_params_best | ( | mcmc * | m, |
const gsl_vector * | new_params_best | ||
) |
References mcmc::params_best.
Referenced by mcmc_check_best(), and read_calibration_file().
void set_params_descr_all | ( | mcmc * | m, |
const char ** | new_par_descr | ||
) |
References mcmc::params_descr.
void set_params_descr_for | ( | mcmc * | m, |
const char * | new_par_descr, | ||
const unsigned int | i | ||
) |
References mcmc::params_descr.
void set_params_for | ( | mcmc * | m, |
const double | new_param, | ||
const unsigned int | i | ||
) |
References assert, and mcmc::params.
Referenced by do_step_for(), main(), markov_chain_step_for(), and read_calibration_file().
void set_params_rejects_for | ( | mcmc * | m, |
const long | new_params_reject, | ||
const unsigned int | i | ||
) |
References mcmc::params_rejects.
Referenced by reset_accept_rejects().
void set_prior | ( | mcmc * | m, |
const double | new_prior | ||
) |
References mcmc::prior.
Referenced by calc_model().
void set_prob | ( | mcmc * | m, |
const double | new_prob | ||
) |
References mcmc::prob.
Referenced by calc_model(), and restart_from_best().
void set_prob_best | ( | mcmc * | m, |
const double | new_prob_best | ||
) |
References mcmc::prob_best.
void set_random | ( | mcmc * | m, |
gsl_rng * | newrandom | ||
) |
References mcmc::random.
void set_steps_all | ( | mcmc * | m, |
const double * | new_steps | ||
) |
References get_n_par, and set_steps_for().
void set_steps_for | ( | mcmc * | m, |
const double | new_step, | ||
const unsigned int | i | ||
) |
References mcmc::params_step.
Referenced by markov_chain_calibrate_alt(), markov_chain_calibrate_orig(), read_calibration_file(), and set_steps_all().
void set_steps_for_normalized | ( | mcmc * | m, |
const double | new_step, | ||
const unsigned int | i | ||
) |