MCMC with MPI and HDF5 table I/O. More...
#include <mcmc_mpi.h>
The parent, o2scl::mcmc_table assembles the MCMC data into objects of type o2scl::table_units . This class additionally writes the MCMC data to a HDF5 table and controls run time on several processors via MPI.
Definition at line 66 of file mcmc_mpi.h.
Public Member Functions | |
virtual void | set_seed () |
Default method for setting the random seed. | |
virtual int | mcmc (size_t np, vec_t &init, vec_t &low, vec_t &high, func_t &func, fill_t &fill) |
Perform an MCMC simulation. | |
virtual void | update_files () |
Update files with current table. | |
virtual int | add_line (const ubvector &pars, double weight, size_t ix, bool new_meas, data_t &dat, fill_t &fill) |
Add a measurement to the table. | |
Customization functions | |
virtual int | mcmc_init () |
User-defined initialization function. | |
virtual void | best_point (ubvector &best, double w_best) |
Output the best point so far. | |
virtual void | first_update (o2scl_hdf::hdf_file &hf) |
Initial write to HDF5 file. | |
int | set_initial_point (std::vector< std::string > &sv, bool itive_com) |
Set the first point. | |
mcmc_mpi () | |
Create an MCMC object with model m . | |
![]() | |
void | reblock (size_t n_blocks) |
Reaverage the data into blocks of a fixed size in order to avoid autocorrelations. More... | |
virtual void | set_names_units (std::vector< std::string > names, std::vector< std::string > units) |
Set the table names and units. | |
std::shared_ptr< o2scl::table_units<> > | get_table () |
Get the output table. | |
void | set_table (std::shared_ptr< o2scl::table_units<> > &t) |
Set the output table. | |
virtual int | add_line (const vec_t &pars, double log_weight, size_t walker_ix, bool new_meas, data_t &dat, fill_t &fill) |
A measurement function which adds the point to the table. | |
![]() | |
virtual int | mcmc (size_t nparams, vec_t &init, vec_t &low, vec_t &high, func_t &func, std::function< int(const vec_t &, double, size_t, bool, data_t &)> &meas) |
Perform an MCMC simulation. More... | |
virtual void | set_proposal (o2scl::prob_cond_mdim< vec_t > &p) |
Set the proposal distribution. | |
virtual void | unset_proposal () |
Go back to random-walk Metropolis with a uniform distribution. | |
Public Attributes | |
std::ofstream | scr_out |
The screen output file. | |
bool | file_opened |
If true, scr_out has been opened. | |
ubvector | initial_point |
If true, output MC accepts and rejects (default true) More... | |
std::string | initial_point_file |
The file containing the initial point. | |
bool | first_file_update |
If true, then first_update() has been called. | |
size_t | chain_index |
Number of complete Markov chain segments. | |
Command-line settings | |
size_t | max_iters |
Maximum number of iterations (default 0) | |
double | max_time |
Time in seconds (default is 86400 seconds or 1 day) | |
bool | output_meas |
Output each measurement. | |
std::string | prefix |
Prefix for output filenames. | |
int | file_update_iters |
The number of MCMC successes between file updates (default 40) | |
int | max_chain_size |
Maximum size of Markov chain (default 10000) | |
![]() | |
size_t | n_accept |
The number of Metropolis steps which were accepted. | |
size_t | n_reject |
The number of Metropolis steps which were rejected. | |
bool | aff_inv |
If true, use affine-invariant Monte Carlo. | |
double | step_fac |
Stepsize factor (default 10.0) | |
size_t | n_warm_up |
Number of warm up steps (successful steps not iterations) (default 0) More... | |
int | user_seed |
If non-zero, use as the seed for the random number generator (default 0) | |
int | verbose |
Output control (default 0) | |
size_t | max_bad_steps |
Maximum number of failed steps when generating initial points with affine-invariant sampling (default 1000) | |
size_t | n_walk |
Number of walkers for affine-invariant MC or 1 otherwise (default 1) | |
bool | err_nonconv |
If true, call the error handler if msolve() or msolve_de() does not converge (default true) | |
bool | always_accept |
If true, accept all steps. | |
double | ai_initial_step |
Initial step fraction for affine-invariance sampling walkers. | |
Protected Types | |
typedef boost::numeric::ublas::vector< double > | ubvector |
typedef boost::numeric::ublas::matrix< double > | ubmatrix |
typedef o2scl::mcmc_table< func_t, fill_t, data_t, vec_t > | parent_t |
![]() | |
typedef std::function< int(const vec_t &, double, size_t, bool, data_t &)> | internal_measure_t |
Measurement functor type for the parent. | |
typedef mcmc_base< func_t, internal_measure_t, data_t, vec_t > | parent_t |
Type of parent class. | |
Protected Attributes | |
o2scl::err_hnd_cpp | error_handler |
Error handler for each thread. | |
size_t | n_params |
The number of parameters. | |
vec_t | low_copy |
A copy of the lower limits for HDF5 output. | |
vec_t | high_copy |
A copy of the upper limits for HDF5 output. | |
MPI properties | |
int | mpi_rank |
The MPI processor rank. | |
int | mpi_nprocs |
The MPI number of processors. | |
double | mpi_start_time |
The MPI starting time. | |
![]() | |
std::vector< std::string > | col_names |
Column names. | |
std::vector< std::string > | col_units |
Column units. | |
std::shared_ptr< o2scl::table_units<> > | tab |
Main data table for Markov chain. | |
std::vector< int > | walker_rows |
Record the last row in the table which corresponds to each walker. | |
![]() | |
rng_gsl | rg |
Random number generator. | |
o2scl::prob_cond_mdim< vec_t > * | prop_dist |
Proposal distribution. | |
bool | pd_mode |
If true, then use the user-specified proposal distribution. | |
bool | warm_up |
If true, we are in the warm up phase. | |
std::vector< vec_t > | current |
Current points in parameter space. | |
std::vector< data_t > | data_arr |
Data array. | |
std::vector< bool > | switch_arr |
Data switch array. | |
std::vector< size_t > | ret_value_counts |
Return value counters. | |
size_t | curr_walker |
Index of the current walker. | |
size_t | n_init_points |
Number of initial points specified by the user;. | |
Integer designating how to set the initial point | |
int | initial_point_type |
static const int | fp_unspecified =-1 |
static const int | fp_last =-2 |
static const int | fp_best =-3 |
Additional Inherited Members | |
![]() | |
static const int | mcmc_done |
Integer to indicate completion. | |
static const int | mcmc_skip |
Integer to indicate rejection. | |
![]() | |
virtual int | fill_line (const vec_t &pars, double log_weight, std::vector< double > &line, data_t &dat, fill_t &fill) |
Fill line with data for insertion into the table. | |
![]() | |
virtual void | mcmc_cleanup () |
Cleanup after the MCMC. | |
virtual void | best_point (vec_t &best, double w_best, data_t &dat) |
Function to run for the best point. | |
ubvector o2scl::mcmc_mpi< func_t, fill_t, data_t, vec_t >::initial_point |
The first point in the parameter space
Definition at line 164 of file mcmc_mpi.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).