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:

  1. It can estimate the auto-correlation time of the data (so-called “logarithmic binning”).

  2. 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

(constructor)

n_log_bins_max

Max. number of bins in the logarithmic accumulator

n_log_bins

Number of bins in the logarithmic accumulator

n_lin_bins_max

Max. number of bins in the linear accumulator

n_lin_bins

Number of bins in the linear accumulator

lin_bin_capacity

Capacity of a linear bin

operator<<

Input a measurement into the accumulator

log_bin_errors

Get standard errors of log binned data

log_bin_errors_all_reduce

Get standard errors of log binned data (MPI Version)

data_input_count

Number of data points put into the accumulator

linear_bins

Returns data stored from linear binning

compress_linear_bins

Increases linear bin capacity and compresses data within