code: def autocorr(x):
      
  
      y = x - x.mean()
      n = len(y)
      result = fftconvolve(y, y[::-1])
      acorr = result[len(result) // 2:]
      acorr /= np.arange(n, 0, -1)
      acorr /= acorr[0]
      return acorr
docs: Compute autocorrelation using FFT for every lag for the input array
      https://en.wikipedia.org/wiki/Autocorrelation#Efficient_computation.
  
      Args:
          x (array-like): An array containing MCMC samples.
  
      Returns:
          np.ndarray: An array of the same size as the input array.