Tomographer  v5.2
Tomographer C++ Framework Documentation
Tomographer::ValueHistogramMHRWStatsCollector< ValueCalculator_, LoggerType, HistogramType_ > Class Template Reference

A StatsCollector which builds a histogram of values calculated with a ValueCalculator for each data sample point. More...

#include <tomographer/mhrwstatscollectors.h>

+ Inheritance diagram for Tomographer::ValueHistogramMHRWStatsCollector< ValueCalculator_, LoggerType, HistogramType_ >:
+ Collaboration diagram for Tomographer::ValueHistogramMHRWStatsCollector< ValueCalculator_, LoggerType, HistogramType_ >:

Public Types

typedef ValueCalculator_ ValueCalculator
 The type which calculates the interesting value. Should be of type interface ValueCalculator Interface.
 
typedef ValueCalculator::ValueType ValueType
 The type to use to represent a calculated distance.
 
typedef HistogramType_ HistogramType
 The type of the histogram. Usually a Histogram with ValueType range type.
 
typedef HistogramType_ ResultType
 Required for compliance with Resultable Interface type.
 
typedef HistogramType::Params HistogramParams
 Structure which holds the parameters of the histogram we're recording.
 

Public Member Functions

 ValueHistogramMHRWStatsCollector (HistogramParams histogram_params, const ValueCalculator &vcalc, LoggerType &logger)
 Simple constructor, initializes with the given values.
 
const HistogramTypehistogram () const
 Get the histogram data collected so far. See HistogramType.
 
const ResultTypegetResult () const
 Get the histogram data collected. This method is needed for Resultable Interface compliance. More...
 
ResultType stealResult ()
 Retrieve the collected histogram data, in compliance with Resultable Interface compliance. More...
 
void init ()
 Part of the MHRWStatsCollector Interface. Initializes the histogram to zeros.
 
void thermalizingDone ()
 Part of the MHRWStatsCollector Interface. No-op.
 
template<bool PrintHistogram = true>
void done ()
 Part of the MHRWStatsCollector Interface. More...
 
template<typename CountIntType , typename PointType , typename LLHValueType , typename MHRandomWalk >
void rawMove (CountIntType k, bool, bool, bool, double, const PointType &, LLHValueType, const PointType &, LLHValueType, MHRandomWalk &)
 Part of the MHRWStatsCollector Interface. No-op.
 
template<typename CountIntType , typename PointType , typename LLHValueType , typename MHRandomWalk >
Eigen::Index processSample (CountIntType k, CountIntType n, const PointType &curpt, LLHValueType, MHRandomWalk &)
 Part of the MHRWStatsCollector Interface. Records the sample in the histogram.
 

Detailed Description

template<typename ValueCalculator_, typename LoggerType = Logger::VacuumLogger, typename HistogramType_ = Histogram<typename ValueCalculator_::ValueType>>
class Tomographer::ValueHistogramMHRWStatsCollector< ValueCalculator_, LoggerType, HistogramType_ >

A StatsCollector which builds a histogram of values calculated with a ValueCalculator for each data sample point.

ValueHistogramMHRWStatsCollector complies both with the MHRWStatsCollector Interface and the Resultable Interface.

This stats collector is suitable for tracking statistics during a MHRandomWalk.

The ValueCalculator is a type expected to implement the ValueCalculator Interface. The argument of the getValue() method should be the same type as the point type of the random walk; the current point of the random walk is passed on as is.

Definition at line 429 of file mhrwstatscollectors.h.

Member Function Documentation

§ done()

template<typename ValueCalculator_, typename LoggerType = Logger::VacuumLogger, typename HistogramType_ = Histogram<typename ValueCalculator_::ValueType>>
template<bool PrintHistogram = true>
void Tomographer::ValueHistogramMHRWStatsCollector< ValueCalculator_, LoggerType, HistogramType_ >::done ( )
inline

Part of the MHRWStatsCollector Interface.

If you call this function with PrintHistogram=true (the default), then this will display the final histogram in the logger at logging level Logger::LONGDEBUG.

If this function is called with PrintHistogram=false, then this is a no-op.

Definition at line 526 of file mhrwstatscollectors.h.

§ getResult()

template<typename ValueCalculator_, typename LoggerType = Logger::VacuumLogger, typename HistogramType_ = Histogram<typename ValueCalculator_::ValueType>>
const ResultType& Tomographer::ValueHistogramMHRWStatsCollector< ValueCalculator_, LoggerType, HistogramType_ >::getResult ( ) const
inline

Get the histogram data collected. This method is needed for Resultable Interface compliance.

Warning
It is strongly advised to only call this function after having finalized the random walk (as is necessary for ValueHistogramWithBinningMHRWStatsCollector::getResult), even though in this implementation the return value would be valid when called at any point after initialization.

Definition at line 489 of file mhrwstatscollectors.h.

§ stealResult()

template<typename ValueCalculator_, typename LoggerType = Logger::VacuumLogger, typename HistogramType_ = Histogram<typename ValueCalculator_::ValueType>>
ResultType Tomographer::ValueHistogramMHRWStatsCollector< ValueCalculator_, LoggerType, HistogramType_ >::stealResult ( )
inline

Retrieve the collected histogram data, in compliance with Resultable Interface compliance.

Warning
Calling this function moves the histogram to the returned type, and resets the histogram in this instance. Further calls to getResult() and/or stealResult() have undefined behavior.

Definition at line 501 of file mhrwstatscollectors.h.


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