def autocov(x):
    """Compute autocovariance estimates for every lag for the input array.

    Args:
        x (array-like): An array containing MCMC samples.

    Returns:
        np.ndarray: An array of the same size as the input array.
    """

    acorr = autocorr(x)
    varx = np.var(x, ddof=1) * (len(x) - 1) / len(x)
    acov = acorr * varx
    return acov