function [tau, dtau] = autocorrelation_time_with_error(A)

% Break up into blocks to estimate uncertainty.
nblocks = 10;
blocksize = floor(length(A)/nblocks);
T = blocksize*nblocks;
tau_i = zeros(1,nblocks);
for i = 1:nblocks
  indices = (blocksize*(i-1)+1):(blocksize*i);
  tau_i(i) = autocorrelation_time(A(indices));
end
dtau = std(tau_i) / sqrt(nblocks);

% Compute estimate of correlation time for entire timeseries.
tau = autocorrelation_time(A);

return;

