Autocorrelation function

The autocorrelation function of a series of samples is defined as:

\[A(k) =\frac{\langle x_{i+k} x_i \rangle - \langle x \rangle ^2}{ \langle x^2 \rangle - \langle x \rangle ^2} \approx\frac{1}{\sigma^2(N-k)}\sum_{i=0}^{N-k-1} (x_{i+k}-\overline{x})(x_i-\overline{x})\]

where \(\overline{x}\) is the mean, \(\sigma^2\) the variance of the series.


make_normalized_autocorrelation(T observable)
  • observable: object with Observable concept

returns the autocorrelation function as a TimeSeries.


#include <triqs/statistics.hpp>
#include <triqs/mc_tools/random_generator.hpp>
using namespace triqs::statistics;
int main() {
  observable<double> A;
  triqs::mc_tools::random_generator RND;
  for (int i = 0; i < 20; i++) A << RND(1.0);
  std::cout << make_normalized_autocorrelation(A) << std::endl;
  return 0;