Tomographer  v4.0
Tomographer C++ Framework Documentation
Tomographer::MHRWTasks::CDataBase< IterCountIntType_, StepRealType_ > Struct Template Reference

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

#include <tomographer/mhrwtasks.h>

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

Public Types

typedef IterCountIntType_ IterCountIntType
 Type used to count the number of iterations.
 
typedef StepRealType_ StepRealType
 Type used to specify the step size.
 
typedef MHRWParams< IterCountIntType, StepRealTypeMHRWParamsType
 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, int base_seed_=0)
 Constructor. More...
 
int getTaskInput (int 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.
 
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 int base_seed
 A base random seed from which each run seed will be derived. More...
 

Detailed Description

template<typename IterCountIntType_ = int, typename StepRealType_ = double>
struct Tomographer::MHRWTasks::CDataBase< IterCountIntType_, StepRealType_ >

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

Member Typedef Documentation

§ MHRWParamsType

template<typename IterCountIntType_ = int, typename StepRealType_ = double>
typedef MHRWParams<IterCountIntType, StepRealType> Tomographer::MHRWTasks::CDataBase< IterCountIntType_, StepRealType_ >::MHRWParamsType

Type to store the parameters of the Metropolis-Hastings random walk (number of runs, sweep size, etc.)

See MHRWParams<IterCountIntType,StepRealType>

Definition at line 88 of file mhrwtasks.h.

Constructor & Destructor Documentation

§ CDataBase()

template<typename IterCountIntType_ = int, typename StepRealType_ = double>
template<typename MHRWParamsType >
Tomographer::MHRWTasks::CDataBase< IterCountIntType_, StepRealType_ >::CDataBase ( MHRWParamsType &&  p,
int  base_seed_ = 0 
)
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 73 of file mhrwtasks.h.

Member Function Documentation

§ getTaskInput()

template<typename IterCountIntType_ = int, typename StepRealType_ = double>
int Tomographer::MHRWTasks::CDataBase< IterCountIntType_, StepRealType_ >::getTaskInput ( int  k) const
inline

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

This simply returns

pcdata->base_seed + k

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

Member Data Documentation

§ base_seed

template<typename IterCountIntType_ = int, typename StepRealType_ = double>
const int Tomographer::MHRWTasks::CDataBase< IterCountIntType_, StepRealType_ >::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 113 of file mhrwtasks.h.

§ mhrw_params

template<typename IterCountIntType_ = int, typename StepRealType_ = double>
const MHRWParamsType Tomographer::MHRWTasks::CDataBase< IterCountIntType_, StepRealType_ >::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<IterCountIntType,StepRealType>

Definition at line 97 of file mhrwtasks.h.


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