Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/sampling.tex
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ \subsection{An explicit example of error estimation}\label{sec:autocorr}
In order to determine the autocorrelation time, we calculate the correlation function
\begin{equation}
\label{eqn:autocorrel}
S_{\hat{O}}(t_{\textrm{Auto}})=\sum_{i=1}^{N_{\textrm{Bin}}-t_{\textrm{Auto}}}\frac{\left(O_i-\left\langle \hat{O}\right\rangle \right)\left(O_{i+t_{\textrm{Auto}}}-\left\langle \hat{O}\right\rangle \right)}{\left(O_i-\left\langle \hat{O}\right\rangle \right)\left(O_{i}-\left\langle \hat{O}\right\rangle \right)}\, ,
S_{\hat{O}}(t_{\textrm{Auto}})=\frac{\sum_{i=1}^{N_{\textrm{Bin}}-t_{\textrm{Auto}}}\left(O_i-\left\langle \hat{O}\right\rangle \right)\left(O_{i+t_{\textrm{Auto}}}-\left\langle \hat{O}\right\rangle \right)}{\sum_{i=1}^{N_{\textrm{Bin}}-t_{\textrm{Auto}}}\left(O_i-\left\langle \hat{O}\right\rangle \right)\left(O_{i}-\left\langle \hat{O}\right\rangle \right)}\, ,
\end{equation}
where $O_i$ refers to the Monte Carlo estimate of the observable $\hat{O}$ in the $i^{\text{th}}$ bin. This function typically shows an exponential decay and the decay rate defines the autocorrelation time.
Comment on lines +77 to 79
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated equation adds the missing sums, but it still uses a single global mean ⟨Ô⟩. In the implementation (Libraries/Modules/errors_mod.F90:1473-1485), the mean (X3) is recomputed for each lag tAuto as the average over the first NBin−tAuto samples, and that lag-dependent mean is used in both numerator and denominator. To match the actual calculation (and fully resolve #258), update the notation to use a tAuto-dependent mean (and define it explicitly).

Suggested change
S_{\hat{O}}(t_{\textrm{Auto}})=\frac{\sum_{i=1}^{N_{\textrm{Bin}}-t_{\textrm{Auto}}}\left(O_i-\left\langle \hat{O}\right\rangle \right)\left(O_{i+t_{\textrm{Auto}}}-\left\langle \hat{O}\right\rangle \right)}{\sum_{i=1}^{N_{\textrm{Bin}}-t_{\textrm{Auto}}}\left(O_i-\left\langle \hat{O}\right\rangle \right)\left(O_{i}-\left\langle \hat{O}\right\rangle \right)}\, ,
\end{equation}
where $O_i$ refers to the Monte Carlo estimate of the observable $\hat{O}$ in the $i^{\text{th}}$ bin. This function typically shows an exponential decay and the decay rate defines the autocorrelation time.
S_{\hat{O}}(t_{\textrm{Auto}})=\frac{\sum_{i=1}^{N_{\textrm{Bin}}-t_{\textrm{Auto}}}\left(O_i-\left\langle \hat{O}\right\rangle_{t_{\textrm{Auto}}} \right)\left(O_{i+t_{\textrm{Auto}}}-\left\langle \hat{O}\right\rangle_{t_{\textrm{Auto}}} \right)}{\sum_{i=1}^{N_{\textrm{Bin}}-t_{\textrm{Auto}}}\left(O_i-\left\langle \hat{O}\right\rangle_{t_{\textrm{Auto}}} \right)\left(O_{i}-\left\langle \hat{O}\right\rangle_{t_{\textrm{Auto}}} \right)}\, ,
\end{equation}
where $O_i$ refers to the Monte Carlo estimate of the observable $\hat{O}$ in the $i^{\text{th}}$ bin, and the lag-dependent mean is defined as
\begin{equation}
\left\langle \hat{O}\right\rangle_{t_{\textrm{Auto}}} = \frac{1}{N_{\textrm{Bin}}-t_{\textrm{Auto}}} \sum_{i=1}^{N_{\textrm{Bin}}-t_{\textrm{Auto}}} O_i \, .
\end{equation}
This function typically shows an exponential decay and the decay rate defines the autocorrelation time.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fassaad What do you think about the copilot suggestion? I'm good either way.

%
Expand Down
Loading