1#ifndef UTIL_AVERAGE_STAGE_H
2#define UTIL_AVERAGE_STAGE_H
106 virtual void sample(
double value);
114 template <
class Archive>
115 void serialize(Archive& ar,
const unsigned int version);
142 double error()
const;
228 virtual void registerDescendant(
AverageStage* descendantPtr);
238 {
return bool(childPtr_); }
244 {
return *childPtr_; }
251 template <
class Archive>
264 if (Archive::is_saving()) {
265 hasChild = (childPtr_ == 0) ? 0 : 1;
271 if (Archive::is_loading()) {
272 long nextStageInterval = stageInterval_*blockFactor_;
273 int nextStageId = stageId_ + 1;
274 childPtr_ =
new AverageStage(nextStageInterval, nextStageId,
275 rootPtr_, blockFactor_);
276 rootPtr_->registerDescendant(childPtr_);
280 if (Archive::is_loading()) {
Evaluate average with hierarchical blocking error analysis.
bool hasChild() const
Does this object have a child AverageStage for block averages?
void setBlockFactor(int blockFactor)
Reset the value of blockFactor.
virtual ~AverageStage()
Destructor.
long stageInterval() const
Return the number of sampled values per block at this stage.
virtual void sample(double value)
Add a sampled value to the ensemble.
virtual void clear()
Initialize all accumulators and recursively destroy all children.
void serialize(Archive &ar, const unsigned int version)
Add a sampled value to the ensemble.
double average() const
Return the average of all sampled values.
double variance() const
Return the variance of all sampled values.
double error() const
Return a naive estimate for the std deviation of the average.
AverageStage & child()
Return the child AverageStage by reference.
long nSample() const
Return the number of sampled values in this sequence.
double stdDeviation() const
Return the standard deviation of all sampled values.
File containing preprocessor macros for error handling.
Utility classes for scientific computation.