MeanWalker
|
This is a template base class for the histogram builders. More...
#include <histogrambuildertemplate.h>
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 Histogram & | getHistogram (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. |
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.
void meanwalker::HistogramBuilderTemplate< WalkerBase >::clearHistograms | ( | ) | [inline] |
Clears the histogram contents (but does not reset the boundaries).
const Histogram& meanwalker::HistogramBuilderTemplate< WalkerBase >::getHistogram | ( | size_t | i | ) | const [inline] |
Obtain the histogram for coordinate i
.
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.
idx | Index of the coordinate for which the values were recorded. |
pValues | The recorded values. |
numValues | The number of recorded values. |
minValue | Set this to the minimum value you want to have histogram entries for. |
maxValue | Set this to the maximum value you want to have histogram entries for. |
const std::vector<const Histogram *> meanwalker::HistogramBuilderTemplate< WalkerBase >::getHistograms | ( | ) | const [inline] |
Obtain all histograms.
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).
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]
void meanwalker::HistogramBuilderTemplate< WalkerBase >::printHistograms | ( | ) | const [inline] |
Print all histograms - or rather the corresponding probability density - to standard output.
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.