From 0cb41564021b0315e95965010b502620b045b9c3 Mon Sep 17 00:00:00 2001
From: Jaron Kent-Dobias <jaron@kent-dobias.com>
Date: Sun, 29 Oct 2017 21:25:43 -0400
Subject: make the hybrid algorithm more pedogogical

---
 monte-carlo.tex | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

(limited to 'monte-carlo.tex')

diff --git a/monte-carlo.tex b/monte-carlo.tex
index 70d026b..d3c3548 100644
--- a/monte-carlo.tex
+++ b/monte-carlo.tex
@@ -228,33 +228,31 @@ H}$ every time a spin is added to it.
   \begin{algorithm}[H]
     \begin{algorithmic}
       \REQUIRE $s\in\G^n$
-      \STATE \textbf{let} $q_1$ and $q_2$ be empty stacks
+      \STATE $s'\gets s$
+      \STATE \textbf{let} $q$ be an empty stack
       \STATE \textbf{let} $i_0\in V$
-      \STATE $q_1.\mathtt{push}(i_0)$
-      \STATE $\sigma\gets s_{i_0}$
-      \STATE \texttt{stopped} $\gets$ \textbf{false}
-      \WHILE {$q_1$ is not empty}
-        \STATE $i\gets q_1.\mathtt{pop}$
-        \IF {$s_i=\sigma$}
+      \STATE $q.\mathtt{push}(i_0)$
+      \STATE $\sigma\gets s_{i_0}'$
+      \STATE \texttt{completed} $\gets$ \textbf{true}
+      \WHILE {$q$ is not empty}
+        \STATE $i\gets q.\mathtt{pop}$
+        \IF {$s_i'=\sigma$}
           \FORALL {$j$ such that $\{i,j\}\in E$}
           \IF {$1-\exp(-2\beta
-            J_{ij}s_is_j)>\mathop{\mathtt{UniformRandom}}(0,1)$}
-          \STATE $q_1.\mathtt{push}(j)$
+            J_{ij}s_i's_j')>\mathop{\mathtt{UniformRandom}}(0,1)$}
+          \STATE $q.\mathtt{push}(j)$
             \ENDIF
           \ENDFOR
-          \STATE $s_i\gets-s_i$
-          \STATE $q_2.\mathtt{push}(i)$
+          \STATE $s_i'\gets-s_i'$
+          \STATE $q.\mathtt{push}(i)$
           \IF {$1-\exp(-2\beta\sigma H)>\mathop{\mathtt{UniformRandom}}(0,1)$}
-          \STATE \texttt{stopped} $\gets$ \textbf{true}
+          \STATE \texttt{completed} $\gets$ \textbf{false}
             \STATE \textbf{break}
           \ENDIF
         \ENDIF
       \ENDWHILE
-      \IF {stopped}
-        \WHILE {$q_2$ is not empty}
-          \STATE $i\gets q_2.\mathtt{pop}$
-          \STATE $s_i\gets-s_i$
-        \ENDWHILE
+      \IF {completed}
+        $s\gets s'$
       \ENDIF
     \end{algorithmic}
     \caption{Hybrid Wolff/Metropolis--Hastings}
-- 
cgit v1.2.3-54-g00ecf

