MeanWalker
Public Member Functions | Protected Member Functions

meanwalker::HistogramBuilderTemplate< WalkerBase > Class Template Reference

This is a template base class for the histogram builders. More...

#include <histogrambuildertemplate.h>

List of all members.

Public Member Functions

bool run (size_t initSteps, size_t finalSteps)
 Let the walkers sample the probability distribution specified during initialization.
void clearHistograms ()
 Clears the histogram contents (but does not reset the boundaries).
const HistogramgetHistogram (size_t i) const
 Obtain the histogram for coordinate i.
const std::vector< const
Histogram * > 
getHistograms () const
 Obtain all histograms.
void printHistograms () const
 Print all histograms - or rather the corresponding probability density - to standard output.

Protected Member Functions

void onNewSample (double functionValue, const double *pCoords)
 This is called on each new sample and by default it performs the necessary functions to process the values in the histograms (so make sure you call this parent implementation when overriding the function in a derived class).
virtual void getHistogramMinMax (size_t idx, const double *pValues, size_t numValues, double &minValue, double &maxValue)
 When calculating the histogram widths automatically this function is called to determine the boundaries based on the recorded values.
virtual void onRecordedValuesProcessed (const double **pValues, size_t numHistograms, size_t numRecords)
 If delayed histogram creation is specified, this function will be called at the time that the recorded samples are processed into the histograms.

Detailed Description

template<class WalkerBase>
class meanwalker::HistogramBuilderTemplate< WalkerBase >

This is a template base class for the histogram builders.

This is a template base class for the histogram builders. It contains all the histogram related code, so that the actual class only needs to provide the appropriate initialization for the type of walker used.


Member Function Documentation

template<class WalkerBase>
void meanwalker::HistogramBuilderTemplate< WalkerBase >::clearHistograms ( ) [inline]

Clears the histogram contents (but does not reset the boundaries).

template<class WalkerBase>
const Histogram& meanwalker::HistogramBuilderTemplate< WalkerBase >::getHistogram ( size_t  i) const [inline]

Obtain the histogram for coordinate i.

template<class WalkerBase>
virtual void meanwalker::HistogramBuilderTemplate< WalkerBase >::getHistogramMinMax ( size_t  idx,
const double *  pValues,
size_t  numValues,
double &  minValue,
double &  maxValue 
) [inline, protected, virtual]

When calculating the histogram widths automatically this function is called to determine the boundaries based on the recorded values.

When calculating the histogram widths automatically this function is called to determine the boundaries based on the recorded values. By default, the boundaries are set to the minimum and maximum values recorded.

Parameters:
idxIndex of the coordinate for which the values were recorded.
pValuesThe recorded values.
numValuesThe number of recorded values.
minValueSet this to the minimum value you want to have histogram entries for.
maxValueSet this to the maximum value you want to have histogram entries for.
template<class WalkerBase>
const std::vector<const Histogram *> meanwalker::HistogramBuilderTemplate< WalkerBase >::getHistograms ( ) const [inline]

Obtain all histograms.

template<class WalkerBase>
void meanwalker::HistogramBuilderTemplate< WalkerBase >::onNewSample ( double  functionValue,
const double *  pCoords 
) [inline, protected]

This is called on each new sample and by default it performs the necessary functions to process the values in the histograms (so make sure you call this parent implementation when overriding the function in a derived class).

template<class WalkerBase>
virtual void meanwalker::HistogramBuilderTemplate< WalkerBase >::onRecordedValuesProcessed ( const double **  pValues,
size_t  numHistograms,
size_t  numRecords 
) [inline, protected, virtual]

If delayed histogram creation is specified, this function will be called at the time that the recorded samples are processed into the histograms.

If delayed histogram creation is specified, this function will be called at the time that the recorded samples are processed into the histograms. The indexing for pValues is as follows: pValues[histogramIndex][recordIndex]

template<class WalkerBase>
void meanwalker::HistogramBuilderTemplate< WalkerBase >::printHistograms ( ) const [inline]

Print all histograms - or rather the corresponding probability density - to standard output.

template<class WalkerBase>
bool meanwalker::HistogramBuilderTemplate< WalkerBase >::run ( size_t  initSteps,
size_t  finalSteps 
) [inline]

Let the walkers sample the probability distribution specified during initialization.

Let the walkers sample the probability distribution specified during initialization. During the initial steps initSteps, the values are not processed into the histograms. During the final steps finalSteps, the values are either processed into the histograms immediately (if the boundaries for the histograms were specified during initialization), or are all recorded for processing into histograms later. If the latter is the case, the HistogramBuilderTemplate::getHistogramMinMax function is called before actually creating the histograms to determine their boundaries based on the recorded values. This determination of the boundaries is only done the first time this function is called and finalSteps is greater than zero.


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