12#include <util/accumulators/AverageStage.h>
13#include <util/param/ParamComposite.h>
102 template <
class Archive>
103 void serialize(Archive& ar,
const unsigned int version);
115 void sample(
double value);
123 void sample(
double value, std::ostream& out);
143 void output(std::ostream& out)
const;
176 double blockAverage()
const;
185 virtual void registerDescendant(
AverageStage* descendantPtr);
188 std::vector<AverageStage*> descendants_;
197 int nSamplePerBlock_;
221 {
return nSamplePerBlock_; }
234 return (iBlock_ && (iBlock_ == nSamplePerBlock_));
240 inline double Average::blockAverage()
const
243 UTIL_THROW(
"Attempt to get block average with no data");
245 return blockSum_/double(iBlock_);
251 template <
class Archive>
257 ar & nSamplePerBlock_;
Evaluate average with hierarchical blocking error analysis.
void serialize(Archive &ar, const unsigned int version)
Add a sampled value to the ensemble.
Calculates the average and variance of a sampled property.
void clear()
Clear all accumulators, set to empty initial state.
virtual ~Average()
Destructor.
int iBlock() const
Get number of samples in current block average.
int nSamplePerBlock() const
Get number of samples per block average.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
void serialize(Archive &ar, const unsigned int version)
Serialize this Average to or from an archive.
void output(std::ostream &out) const
Output final statistical properties to file.
void readParameters(std::istream &in)
Read parameter nSamplePerBlock from file and initialize.
double blockingError() const
Return estimated error on average from blocking analysis.
bool isBlockComplete() const
Is the current block average complete?
void sample(double value)
Add a sampled value to the ensemble.
void setNSamplePerBlock(int nSamplePerBlock)
Set nSamplePerBlock.
Saving archive for binary istream.
Saving / output archive for binary ostream.
An object that can read multiple parameters from file.
File containing preprocessor macros for error handling.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.