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

Constant data structure for MH random walk tasks with a value histogram stats collector. More...

#include <tomographer/mhrw_valuehist_tools.h>

+ Inheritance diagram for Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >:
+ Collaboration diagram for Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >:

Public Types

typedef MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ > Base
 The MHRWTasks::CDataBase base class.
 
typedef Base::MHWalkerParams MHWalkerParams
 The MHWalkerParams required for our MHWalker (for instance a MHWalkerParamsStepSize)
 
typedef Base::RngSeedType RngSeedType
 Type of the seed for the pseudo-random number generator.
 
typedef Base::IterCountIntType IterCountIntType
 The integer type which serves to count the number of iterations (see MHRWParams)
 
typedef HistCountIntType_ HistCountIntType
 The integer counting type in our underlying raw histogram type.
 
typedef ValueCalculator_ ValueCalculator
 The class which calculates the value we are collecting a histogram of (ValueCalculator Interface compliant)
 
typedef CountRealType_ CountRealType
 The real type which serves to average histogram counts (typically double)
 
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::ValueStatsCollectorResultType ValueStatsCollectorResultType
 The result type of our stats collector. More...
 
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::MHRWStatsResultsBaseType MHRWStatsResultsBaseType
 Stores result of the stats collector. May serve as base class for your own MHRWStatsResults class. More...
 
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::HistogramType HistogramType
 The histogram type reported by the task. More...
 
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::HistogramParams HistogramParams
 The appropriate parameters type for the histogram reported by the task.
 
typedef MHRWParams< MHWalkerParams, IterCountIntTypeMHRWParamsType
 Type for the parameters of the random walk.
 
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::AggregatedHistogramType AggregatedHistogramType
 
- Public Types inherited from Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >
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<ENABLED_IF( !UseBinningAnalysis) >
 CDataBase (const ValueCalculator &valcalc_, HistogramParams histogram_params_, MHRWParamsType p, RngSeedType base_seed=0)
 Constructor (use only without binning analysis)
 
template<ENABLED_IF( UseBinningAnalysis) >
 CDataBase (const ValueCalculator &valcalc_, HistogramParams histogram_params_, int binning_num_levels_, MHRWParamsType p, RngSeedType base_seed=0)
 Constructor (use only with binning analysis)
 
template<typename LoggerType , ENABLED_IF( !UseBinningAnalysis) >
ValueHistogramMHRWStatsCollector< ValueCalculator, LoggerType, HistogramTypecreateValueStatsCollector (LoggerType &logger) const
 Create the stats collector (without binning analysis) More...
 
template<typename LoggerType , ENABLED_IF( UseBinningAnalysis) >
ValueHistogramWithBinningMHRWStatsCollector< typename tomo_internal::valuehist_types< CDataBase, true >::BinningMHRWStatsCollectorParams, LoggerType > createValueStatsCollector (LoggerType &logger) const
 Create the stats collector (with binning analysis) More...
 
template<typename TaskResultType >
AggregatedHistogramType aggregateResultHistograms (const std::vector< TaskResultType *> &task_result_list)
 Convenience function for aggregating histograms resulting from value-histogram tasks. More...
 
- Public Member Functions inherited from Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >
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 ValueCalculator valcalc
 The value calculator instance.
 
const HistogramParams histogram_params
 The parameters of the histogram that we are collecting.
 
const Tools::StoreIfEnabled< int, UseBinningAnalysisbinningNumLevels
 The number of levels in the binning analysis (only if we are using a binning analysis)
 
- Public Attributes inherited from Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ >
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...
 

Static Public Attributes

static constexpr bool UseBinningAnalysis = UseBinningAnalysis_
 Whether or not we are to use a binning analysis for calculating the error bars.
 

Detailed Description

template<typename ValueCalculator_, bool UseBinningAnalysis_ = true, typename MHWalkerParams_ = MHWalkerParamsStepSize<double>, typename RngSeedType_ = std::mt19937::result_type, typename IterCountIntType_ = int, typename CountRealType_ = double, typename HistCountIntType_ = IterCountIntType_>
struct Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >

Constant data structure for MH random walk tasks with a value histogram stats collector.

You should define your TaskCData class to inherit this class, and be compliant with the MHRandomWalkTaskCData Interface. This class already inherits MHRWTasks::CDataBase, so you only have to inherit this class and provide a createMHWalker() method (see MHRandomWalkTaskCData Interface). (Note that your class will automatically be compliant with the TaskCData Interface in this way.)

Look at the file test/minimal_tomorun.cxx for an example of you to define your cdata class.

We provide some useful typedefs, as well as a createValueStatsCollector() which should be used by subclasses in the setupRandomWalkAndRun() method of their MHRandomWalkTaskCData Interface implementation.

Since
Changed in Tomographer 5.0: Removed StepRealType template parameter, added MHWalkerParams, beware the new order!
Template Parameters
ValueCalculatorthe value calculator type you wish to use; defining which value you are interested in collecting a histogram of during the random walk;
UseBinningAnalysiswhether or not to use a binning analysis to obtain reliable error bars during the random walk.
MHWalkerParamsThe MHWalkerParams required for our MHWalker (for instance a MHWalkerParamsStepSize)
RngSeedTypeThe type used to store the seed of the pseudo random number generator. See MHRWTasks::CDataBase.
IterCountIntTypethe integer type to use for counting iterations.
CountRealTypethe real type to use when calculating the scaled histogram with error bars.
HistCountIntTypethe integer type to record the histogram counts in the underlying raw histogram.

Note: if your subclass also takes a template parameter to allow or not the use of a binning analysis, then you'll have to define two conditionally enabled constructors to cover both cases. For instance (see also the code in tomorun/tomorun_dispatch.h for another example):

struct MyCData
{
TOMOGRAPHER_ENABLED_IF(!BinningAnalysisEnabled)
: Base(valcalc,
typename Base::HistogramParams(...),
typename Base::MHRWParamsType(...),
base_seed)
{ ... }
TOMOGRAPHER_ENABLED_IF(BinningAnalysisEnabled)
MyCData(ValueCalculator valcalc, RngSeedType base_seed, int binning_analysis_num_levels, ...)
: Base(valcalc,
typename Base::HistogramParams(...),
binning_analysis_num_levels,
typename Base::MHRWParamsType(...),
base_seed)
{ ... }
...
};

Definition at line 235 of file mhrw_valuehist_tools.h.

Member Typedef Documentation

§ HistogramType

template<typename ValueCalculator_ , bool UseBinningAnalysis_ = true, typename MHWalkerParams_ = MHWalkerParamsStepSize<double>, typename RngSeedType_ = std::mt19937::result_type, typename IterCountIntType_ = int, typename CountRealType_ = double, typename HistCountIntType_ = IterCountIntType_>
typedef tomo_internal::valuehist_types<CDataBase,UseBinningAnalysis>::HistogramType Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::HistogramType

The histogram type reported by the task.

Depending on whether we are using a binning analysis, this histogram type will have error bars.

It is either:

Definition at line 304 of file mhrw_valuehist_tools.h.

§ MHRWStatsResultsBaseType

template<typename ValueCalculator_ , bool UseBinningAnalysis_ = true, typename MHWalkerParams_ = MHWalkerParamsStepSize<double>, typename RngSeedType_ = std::mt19937::result_type, typename IterCountIntType_ = int, typename CountRealType_ = double, typename HistCountIntType_ = IterCountIntType_>
typedef tomo_internal::valuehist_types<CDataBase,UseBinningAnalysis>::MHRWStatsResultsBaseType Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::MHRWStatsResultsBaseType

Stores result of the stats collector. May serve as base class for your own MHRWStatsResults class.

Depending on UseBinningAnalysis, this is either MHRWStatsResultsBaseSimple, or directly the corresponding ValueHistogramWithBinningMHRWStatsCollectorResult type.

Remember, this class takes a single argument in the constructor which is a rvalue-reference to the result of the value stats collector.

Definition at line 288 of file mhrw_valuehist_tools.h.

§ ValueStatsCollectorResultType

template<typename ValueCalculator_ , bool UseBinningAnalysis_ = true, typename MHWalkerParams_ = MHWalkerParamsStepSize<double>, typename RngSeedType_ = std::mt19937::result_type, typename IterCountIntType_ = int, typename CountRealType_ = double, typename HistCountIntType_ = IterCountIntType_>
typedef tomo_internal::valuehist_types<CDataBase,UseBinningAnalysis>::ValueStatsCollectorResultType Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::ValueStatsCollectorResultType

The result type of our stats collector.

This is either:

  • (without binning analysis): a simple histogram type, without error bars
  • (with binning analysis): a structure containing a histogram with error bars, along with a convergence analysis of the errors. It is a ValueHistogramWithBinningMHRWStatsCollectorResult type.

Definition at line 275 of file mhrw_valuehist_tools.h.

Member Function Documentation

§ aggregateResultHistograms()

template<typename ValueCalculator_ , bool UseBinningAnalysis_ = true, typename MHWalkerParams_ = MHWalkerParamsStepSize<double>, typename RngSeedType_ = std::mt19937::result_type, typename IterCountIntType_ = int, typename CountRealType_ = double, typename HistCountIntType_ = IterCountIntType_>
template<typename TaskResultType >
AggregatedHistogramType Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::aggregateResultHistograms ( const std::vector< TaskResultType *> &  task_result_list)
inline

Convenience function for aggregating histograms resulting from value-histogram tasks.

The TaskResultType is expected to be a subclass of MHRWStatsResultsBaseSimple. This will automatically be the case if you're using our CDataBase type, and if you have defined your custom MHRWStatsResults type (see MHRandomWalkTaskCData Interface) using CDataBase::MHRWStatsResultsBaseType as base class.

Definition at line 399 of file mhrw_valuehist_tools.h.

§ createValueStatsCollector() [1/2]

template<typename ValueCalculator_ , bool UseBinningAnalysis_ = true, typename MHWalkerParams_ = MHWalkerParamsStepSize<double>, typename RngSeedType_ = std::mt19937::result_type, typename IterCountIntType_ = int, typename CountRealType_ = double, typename HistCountIntType_ = IterCountIntType_>
template<typename LoggerType , ENABLED_IF( !UseBinningAnalysis) >
ValueHistogramMHRWStatsCollector<ValueCalculator,LoggerType,HistogramType> Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::createValueStatsCollector ( LoggerType &  logger) const
inline

Create the stats collector (without binning analysis)

This method is provided so that user-provided CData random walk description classes can easily create the necessary value histogram stats collector for collecting a histogram of values during a MHRandomWalkTask. This function should typically be called from within the user's setupRandomWalkAndRun() function.

Definition at line 351 of file mhrw_valuehist_tools.h.

§ createValueStatsCollector() [2/2]

template<typename ValueCalculator_ , bool UseBinningAnalysis_ = true, typename MHWalkerParams_ = MHWalkerParamsStepSize<double>, typename RngSeedType_ = std::mt19937::result_type, typename IterCountIntType_ = int, typename CountRealType_ = double, typename HistCountIntType_ = IterCountIntType_>
template<typename LoggerType , ENABLED_IF( UseBinningAnalysis) >
ValueHistogramWithBinningMHRWStatsCollector< typename tomo_internal::valuehist_types<CDataBase, true>::BinningMHRWStatsCollectorParams, LoggerType> Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::createValueStatsCollector ( LoggerType &  logger) const
inline

Create the stats collector (with binning analysis)

This method is provided so that user-provided CData random walk description classes can easily create the necessary value histogram stats collector for collecting a histogram of values during a MHRandomWalkTask. This function should typically be called from within the user's setupRandomWalkAndRun() function.

Definition at line 372 of file mhrw_valuehist_tools.h.


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