triqs::stat::accumulator
#include <triqs/stat.hpp>
template<typename T> class accumulator
The class takes in measurements during a Monte Carlo simulation and serves a dual purpose:
It can estimate the auto-correlation time of the data (so-called “logarithmic binning”).
It can average groups of consecutive measurements and store the final data (so-called “linear binning”).
The accumulators can be configured to perform either or both of these purposes, as needed. The design is purposefully flexible – it is useful both where the auto-correlation time \(\tau\) of the data is known as well as when it has to be estimated during the simulation.
Logarithmic (Log) Binning
This part of the accumulator is used to estimate the autocorrelation time of the data, by calculating the standard error of the data binned with different bin sizes. For correlated data, the error should grow as the bin size increases up to the autocorrelation time, where it saturates.
The log binning uses bin sizes that are powers of two \(2, 4, 8, 16, \ldots\) up to a user-defined maximum. Note that binning is performed only once there is at one full bin of data at a given size – any partial accumulation is not considered. In the the end, one can obtain the list of standard errors for the different levels of binning; this should be analyzed to see if saturation with size has occurred.
Note
Underestimating the auto-correlation time and a lack of ergodicity are common sources of systematic
errors in Monte Carlo simulations. Provided the computational and memory costs are acceptable, it is advisable to always turn on logarithmic binning to check that \(\tau\) was estimated correctly and acts as expected.
Linear (Lin) Binning
This part of the accumulator is responsible for partially averaging (binning) and storing the data. It takes in data and accumulates it in a bin up to a user-defined bin-size. At every point, a bin stores the mean value of the data within it bin. If the bin size is larger then the auto-correlation time \(\tau\) of the measurement, the bins are independent statistical samples, which can be used for further analysis.
Member functions
Max. number of bins in the logarithmic accumulator |
|
Number of bins in the logarithmic accumulator |
|
Max. number of bins in the linear accumulator |
|
Number of bins in the linear accumulator |
|
Capacity of a linear bin |
|
Input a measurement into the accumulator |
|
Get standard errors of log binned data |
|
Get standard errors of log binned data (MPI Version) |
|
Number of data points put into the accumulator |
|
Returns data stored from linear binning |
|
Increases linear bin capacity and compresses data within |