1#ifndef UTIL_AUTO_CORR_STAGE_H
2#define UTIL_AUTO_CORR_STAGE_H
11#include <util/containers/RingBuffer.h>
12#include <util/containers/DArray.h>
52 template <
typename Data,
typename Product>
89 virtual void sample(Data value);
102 template <
class Archive>
103 void serialize(Archive& ar,
const unsigned int version);
117 void output(std::ostream& out);
128 void output(std::ostream& out, Product aveSq);
186 double corrTime(Product aveSq)
const;
231 template <
class Archive>
304 template <
typename Data,
typename Product>
306 {
return bool(childPtr_); }
311 template <
typename Data,
typename Product>
313 {
return *childPtr_; }
Hierarchical auto-correlation function algorithm.
long stageInterval() const
Return the number of primary values per block at this stage.
int bufferCapacity() const
Return capacity of history buffer.
void output(std::ostream &out)
Output the autocorrelation function, assuming zero mean.
AutoCorrStage()
Constructor.
int bufferSize() const
Return current size of history buffer.
void serialize(Archive &ar, const unsigned int version)
Serialize to/from an archive.
void clear()
Clear accumulators and destroy descendants.
void serializePrivate(Archive &ar, const unsigned int version)
Serialize private data members, and descendants.
AutoCorrStage & child()
Return the child AutoCorrStage by reference.
virtual void sample(Data value)
Sample a value.
Product autoCorrelation(int t) const
Return autocorrelation at a given time, assuming zero average.
virtual ~AutoCorrStage()
Destructor.
double corrTime() const
Estimate of autocorrelation time, in samples.
long nSample() const
Return the number of sampled values.
virtual void registerDescendant(AutoCorrStage< Data, Product > *ptr)
Register the creation of a descendant stage.
int bufferCapacity_
Physical capacity (# of elements) of buffer, corr, and nCorr.
int maxStageId_
Maximum allowed stage index (controls maximum degree of blocking).
int blockFactor_
Number of values per block (ratio of intervals for successive stages).
bool hasChild() const
Does this have a child AutoCorrStage?
void allocate()
Allocate memory and initialize to empty state.
void setParam(int bufferCapacity=64, int maxStageId=0, int blockFactor=2)
Set all parameters and allocate to initialize state.
Dynamically allocatable contiguous array template.
Class for storing history of previous values in an array.
File containing preprocessor macros for error handling.
Utility classes for scientific computation.