Tomographer  v5.2
Tomographer C++ Framework Documentation
Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ > Struct Template Reference

Data needed to be accessible to the working code. More...

#include <tomographer/mhrwtasks.h>

+ Inheritance diagram for Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >:
+ Collaboration diagram for Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >:

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, IterCountIntTypeMHRWParamsType
 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 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

const MHRWParamsType mhrw_params
 Parameters of the random walk. More...
 
const RngSeedType base_seed
 A base random seed from which each run seed will be derived. More...
 

Detailed Description

template<typename MHWalkerParams_, typename IterCountIntType_ = int, typename RngSeedType_ = std::mt19937::result_type>
struct Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >

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 133 of file mhrwtasks.h.

Member Typedef Documentation

§ MHRWParamsType

template<typename MHWalkerParams_ , typename IterCountIntType_ = int, typename RngSeedType_ = std::mt19937::result_type>
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 151 of file mhrwtasks.h.

§ RngSeedType

template<typename MHWalkerParams_ , typename IterCountIntType_ = int, typename RngSeedType_ = std::mt19937::result_type>
typedef RngSeedType_ Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::RngSeedType

Type used to specify the seed of the random number generator.

Since
Added in Tomographer 5.0

Definition at line 144 of file mhrwtasks.h.

Constructor & Destructor Documentation

§ CDataBase()

template<typename MHWalkerParams_ , typename IterCountIntType_ = int, typename RngSeedType_ = std::mt19937::result_type>
template<typename MHRWParamsType >
Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::CDataBase ( MHRWParamsType &&  p,
RngSeedType  base_seed_ 
)
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 161 of file mhrwtasks.h.

Member Function Documentation

§ getTaskInput()

template<typename MHWalkerParams_ , typename IterCountIntType_ = int, typename RngSeedType_ = std::mt19937::result_type>
template<typename TaskNoCountIntType >
RngSeedType Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::getTaskInput ( TaskNoCountIntType  k) const
inline

Returns a random seed to seed the random number generator with for run number k.

This simply returns

This should be considered as 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!

Definition at line 202 of file mhrwtasks.h.

§ printBasicCDataMHRWInfo()

template<typename MHWalkerParams_ , typename IterCountIntType_ = int, typename RngSeedType_ = std::mt19937::result_type>
void Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >::printBasicCDataMHRWInfo ( std::ostream str) const
inline

Get some human-readable info about the random walk as a string.

Definition at line 213 of file mhrwtasks.h.

Member Data Documentation

§ base_seed

template<typename MHWalkerParams_ , typename IterCountIntType_ = int, typename RngSeedType_ = std::mt19937::result_type>
const 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.

Definition at line 190 of file mhrwtasks.h.

§ mhrw_params

template<typename MHWalkerParams_ , typename IterCountIntType_ = int, typename RngSeedType_ = std::mt19937::result_type>
const 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>

Definition at line 174 of file mhrwtasks.h.


The documentation for this struct was generated from the following file: