Tomographer
v5.3
Tomographer C++ Framework Documentation
|
Data needed to be accessible to the working code. More...
#include <tomographer/mhrwtasks.h>
Public Types | |
typedef IterCountIntType_ | IterCountIntType |
Type used to count the number of iterations. | |
typedef MHWalkerParams_ | MHWalkerParams |
Type used to specify the step size. | |
typedef RngSeedType_ | RngSeedType |
Type used to specify the seed of the random number generator. More... | |
typedef MHRWParams< MHWalkerParams, IterCountIntType > | MHRWParamsType |
Type to store the parameters of the Metropolis-Hastings random walk (number of runs, sweep size, etc.) More... | |
Public Member Functions | |
template<typename MHRWParamsType > | |
CDataBase (MHRWParamsType &&p, RngSeedType base_seed_) | |
Constructor. More... | |
template<typename MHRWParamsType > | |
CDataBase (MHRWParamsType &&p, std::vector< RngSeedType > task_seeds_) | |
Constructor. More... | |
CDataBase () | |
Construct an invalid object – ONLY for use with Boost.serialization. | |
template<typename TaskNoCountIntType > | |
RngSeedType | getTaskInput (TaskNoCountIntType k) const |
Returns a random seed to seed the random number generator with for run number k. More... | |
void | printBasicCDataMHRWInfo (std::ostream &str) const |
Get some human-readable info about the random walk as a string. More... | |
std::string | getBasicCDataMHRWInfo () const |
Get some human-readable info about the random walk as a string, see printBasicCDataMHRWInfo() | |
Public Attributes | |
MHRWParamsType | mhrw_params |
Parameters of the random walk. More... | |
RngSeedType | base_seed |
A base random seed from which each run seed will be derived. More... | |
std::vector< RngSeedType > | task_seeds |
A list of random seeds to use for each task. More... | |
Data needed to be accessible to the working code.
This is only a base class for the actual CData. The actual CData must additionally provide some methods, e.g. to create the random walk and stats collectors. See MHRandomWalkTaskCData Interface.
Stores the parameters to the random walk.
Definition at line 81 of file mhrwtasks.h.
typedef MHRWParams<MHWalkerParams, IterCountIntType> Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::MHRWParamsType |
Type to store the parameters of the Metropolis-Hastings random walk (number of runs, sweep size, etc.)
See MHRWParams<MHWalkerParams,IterCountIntType>
Definition at line 99 of file mhrwtasks.h.
typedef RngSeedType_ Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::RngSeedType |
Type used to specify the seed of the random number generator.
Definition at line 92 of file mhrwtasks.h.
|
inline |
Constructor.
Make sure to initialize base_seed to something quite random (e.g. current time in seconds) so that independent runs of your program won't produce the exact same results.
Definition at line 109 of file mhrwtasks.h.
|
inline |
Constructor.
Using this constructor the seed list is set, which takes precedence over base_seed.
Definition at line 124 of file mhrwtasks.h.
|
inline |
Returns a random seed to seed the random number generator with for run number k.
This function provides the input of the k-th task. Each task must of course have a different seed, otherwise we will just repeat the same "random" walks!
If task_seeds is not empty, then this function simply returns task_seeds[k]. It is an error if k is not in range for that vector. In other words, if you give a list of seeds with task_seeds, you need to specify enough seeds to cover all tasks.
If task_seeds is empty, then this simply returns base_seed + k
.
Definition at line 194 of file mhrwtasks.h.
|
inline |
Get some human-readable info about the random walk as a string.
Definition at line 216 of file mhrwtasks.h.
RngSeedType Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::base_seed |
A base random seed from which each run seed will be derived.
For each new random walk, a new pseudorandom number generator instance is created with a new seed.
In order to be able to reproduce results, the seeds are set deterministically from the base_seed, by using for the random seed of the k-th random walk: seed[k] = base_seed + k
Thus, by setting the base_seed to a fixed value you can reproduce all the results of a run. However, in order for your program not to output exactly the same thing if it is run a second time, and to make sure the points are indeed random, you must randomize base_seed, e.g. using the current time.
const
attribute (to make serialization easier; anyway in multiprocessing implementations a const pointer to this class is kept ensuring const-ness already) Definition at line 166 of file mhrwtasks.h.
MHRWParamsType Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::mhrw_params |
Parameters of the random walk.
Stores the number of iterations per sweep, the number of thermalizing sweeps, the number of "live" sweeps, and the step size of the random walk.
See MHRWParams<MHWalkerParams,IterCountIntType>
const
attribute (to make serialization easier; anyway in multiprocessing implementations a const pointer to this class is kept ensuring const-ness already) Definition at line 146 of file mhrwtasks.h.
std::vector<RngSeedType> Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::task_seeds |
A list of random seeds to use for each task.
If set, this list of seeds takes precedence over base_seed. The seed at index number k will be fed to the corresponding task.
Definition at line 175 of file mhrwtasks.h.