ALPS Project: alea library

Binning strategies

Depending on the type of Monte Carlo simulation and the intended evaluations, different amount of information needs to be stored for the evaluation. In order of increasing memory and time complexity we have implemented three strategies:
  1. NoBinning is appropriate for simulations without any correlations between subsequent measurements.
  2. SimpleBinning can estimate autocorrelations and calculate error estimates taking into account autocorrelation effects of observables.
  3. DetailedBinning and FixedBinning can estimate crosscorrelations in addition to autocorrelations. They store full or binned time series and can evaluate error estimates for expressions containing functions of more than one observable in a jack-knife procedure, taking into account also cross-correlations.

Header file nobinning.h

This header contains a strategy without binning, where only the number of measurements, variance, mean value, minimum and maximum value are kept. It is the most space-saving binning strategy, but this is paid for by restricted evaluation options.

The error is calculated from the variance assuming no autocorrelations. Thus it should not be used for Markov-chain like Monte Carlo procedures, where autocorrelation effects are important. Also, equilibration (thermalization) times cannot be changed after the measurements.

namespace alps {
template <class T> class NoBinning
{
NoBinning();
};

typedef BasicSimpleObservable<int32_t, NoBinning<int32_t> > SimpleIntObservable;
typedef BasicSimpleObservable<double, NoBinning<double> > SimpleRealObservable;

typedef BasicSimpleObservable<std::valarray<int32_t>, NoBinning<std::valarray<int32_t> > > SimpleIntVectorObservable;
typedef BasicSimpleObservable<std::valarray<double>, NoBinning<std::valarray<double> > > SimpleRealVectorObservable;
}
There is only a default constructor and no argument needs to be passed to the constructor of BasicSimpleObservable<T,NoBinning<T> >.

The typedefs define useful short-cut names for the most common observables without any binning.

Header file simplebinning.h

This header contains the simplest binning strategy, where in addition to the number of measurements, variance, mean value, minimum and maximum value, also the means and mean squares of bins (averages of consecutive measurements) with sizes of powers of 2 are kept. This allows the calculation of autocorrelation times, and the judgement of convergence of a simulation. If the error estimates converge as a function of bin size (as seens in the output), the autocorrelation time, and the errors can be assumed to be reliable. On the other hand if the errors do not converge with increased bin size, neither error nor autocorrelation estimate are reliable and the simulation has to be run for much longer times.

We wish to emphasize that this is not a black-box library but the user has to bring his own judgement to evaluate the results of any Monte Carlo simulation.

namespace alps {
template <class T> class SimpleBinning
{
SimpleBinning();
};
}
There is only a default constructor and no argument needs to be passed to the constructor of BasicSimpleObservable<T,SimpleBinning<T> >.

Header file detailedbinning.h

This header contains elaborate binning strategies, storing full or binned time series of the measurements. This allows for reliable error estimates for expressions containing functions of more than one observable in a jack-knife procedure, taking into account also cross-correlations.

namespace alps {
template< class T> class FixedBinning
{
public:
typedef T value_type;
FixedBinning(uint32_t binsize=1)'
};

template< class T> class DetailedBinning
{
public:
typedef T value_type;
DetailedBinning(uint32_t binnum=128);
};

typedef BasicSimpleObservable<int32_t,DetailedBinning<int32_t> > IntObservable;
typedef BasicSimpleObservable<double,DetailedBinning<double> > RealObservable;

typedef BasicSimpleObservable<int32_t,FixedBinning<int32_t> > IntTimeSeriesObservable;
typedef BasicSimpleObservable<double,FixedBinning<double> > RealTimeSeriesObservable;

typedef BasicSimpleObservable< std::valarray<int32_t> ,
DetailedBinning<std::valarray<int32_t> > > IntVectorObservable;
typedef BasicSimpleObservable< std::valarray<double> ,
DetailedBinning<std::valarray<double> > > RealVectorObservable;
}
The first strategy, FixedBinning keeps a time series of all measurements, averaging binsize values into one bin. The storage requirements for N measurements scales as 2*typeof(T)*N/binsize.

The second strategy, DetailedBinning has a fixed maximum number of bins instead of a fixed bin size. It starts by filling bins with one number per bin until binnum measurements have been recorded, whereupon the number of measurements per bin is doubled and the number of bins halfed, until again all bins are filled and their size doubled.

We again wish to emphasize that this is not a black-box library but the user has to bring his own judgement to evaluate the results of any Monte Carlo simulation. In order for a jack-knifer analysis of errors to be reliable the bin-size has to be much larger than the autocorrelation time and at least about thirty bins have to be available. Also since the jack-knife analysis scales with the square of the number of bins care has to be taken in the choice of parameters.

The typedefs define useful short-cut names for the most common observables with binning.


copyright (c) 1994-2010 by Matthias Troyer

Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)