import numpy as np
[docs]
def xx(x, i):
r"""Propagator average per path: :math:`\frac{1}{N-1}\sum_{j=0}^{N-2} x_{j+i}\, x_{j}`.
Parameters
----------
x : ndarray
Matrix of paths, shape (N_c, N-1), where N_c is the number of
configurations and N-1 is the number of lattice sites per path
(periodic boundary conditions).
i : int
Time-separation index; the correlator is :math:`\langle x_{j+i} x_j \rangle`.
Returns
-------
ndarray
Array of per-path averages, shape (N_c,).
"""
avg = np.mean(x * np.roll(x, -i, axis=1), axis=1)
return avg
[docs]
def xx2(x, **kwargs):
r"""Squared propagator average per path: :math:`\bigl(\frac{1}{N-1}\sum_{j} x_{j+i} x_j\bigr)^2`.
Parameters
----------
x : ndarray
Matrix of paths, shape (N_c, N-1).
**kwargs
Additional keyword arguments forwarded to :func:`xx` (e.g. ``i``).
Returns
-------
ndarray
Array of squared per-path averages, shape (N_c,). Used for variance estimates.
"""
return xx(x, **kwargs) ** 2