%%%%%%%%%%%%%%%%%%%%%%%  algpsuedocode.tex  %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% example of typesetting psuedocode using packages
%  ltexpprt
%  algpseudocode

\documentclass[twoside,leqno,twocolumn]{article}

\usepackage{ltexpprt}
\usepackage{algpseudocode}

\newcommand\anon[2]{{#2}} %known

\begin{document}

\title{\Large ltexpprt with \textbackslash usepackage\{algpseudocode\} for SIAM IMR}
\author{\anon{anon}{samitch}}   

\date{}

\maketitle

\begin{abstract} \small\baselineskip=9pt An abstract is a brief summary of the paper's contributions, written for experts. We give an example tex file that typesets pseudocode using the package algpseudocode, for SIAM IMR papers and research notes, etc.
\end{abstract}


\section{Introduction}
An introduction is a gentler description and summary of the paper than the abstract, written for non-experts. It describes the paper's concepts, contribution, context and significance. Open the algpsuedocode.tex file in a \LaTeX\ or plain text editor for a working example of how to typeset pseudocode.

\section{Algorithm}
\newcommand{\squarecut}{scooped-square}
\newcommand{\True}{\texttt{True}}
\newcommand{\False}{\texttt{False}}

% works with \usepackage{algpseudocode}
\begin{algorithm}[Deterministic-MPS]{maximal Poisson-disk sampling}
  \begin{algorithmic} [1]
  \label{alg:deterministicmps}
\Require Rectangular grid $\mathcal{G}$ of whole grid squares
\Require Flag if domain is periodic: \True\ or \False
\Ensure Maximal Poisson-disk sampling of rectangle
    \Function{Deterministic-MPS}{$\mathcal{G}$}
    \State // {Initialize Grid $\mathcal{G}$}
    \For{$g \in \mathcal{G}$}
      \State $g.\textrm{point} = (u,v)$ uniform random in square
      \State $g.\textrm{time} = A e^{-Aw}$, rand $w$, expovariate in area
      \State $g.\textrm{scooped-square}$ = square polygon $g$
    \EndFor
    \State Global pre-pass heuristic
    \State // {Find locally-early squares}
     \For{{$g \in \mathcal{G}$} and {$h \in \textrm{neighbors}(g)$}}
      \State increment \#antecedents of $g$ or $h$ (later)
     \EndFor
     \For{{$g \in \mathcal{G}$}}
       \State EarlySquares.add($g$ if no antecedents)
     \EndFor

    \State // {Accept samples and update}
    \Repeat 
        \State $g=$ EarlySquares.pop()  \Comment{any order}
        \State accept $g.\textrm{point}$ as Poisson-disk sample
         \For{$h \in \textrm{neighbors}(g)$}
           \State decrement h.antecedents \Comment{g no longer blocks h}
           \State // {resample candidates covered by disk($g.\textrm{point}$)}
	   \If{$h.\textrm{point} \in \textrm{disk}(g.\textrm{point})$}
	   \State $h.\textrm{scooped-square} \mathrel{-}= \textrm{disk}(g.\textrm{point})$ \label{line:scoop}
	   \If{$h.\textrm{\squarecut}$ is empty}
	     \State $h.\textrm{time} = \infty$
	   \Else
  	     \State trim chocks from $h.\textrm{\squarecut}$  \label{line:trim}
	     \State triangulate remaining polygon  \label{line:triangulate}
	     \State pick $U \in \{ \textrm{chocks, triangles} \}$ by area  \label{line:sampleregion}
	     \State sample $h.\textrm{point} \in U$ uniform by area \label{line:samplepoint}
	     \State $h.\textrm{time}\, \mathrel{+}= $ expovar( A($h.\textrm{\squarecut}$) )
	   \EndIf
           \For{$s \in \textrm{neighbors}(h)$}
             \If{$h$ is later than $s$, but used to be earlier}
             \State increment h.antecedents
             \State decrement $s$.antecedents
             \State EarlySquares.add( $s$ if no antecedents )
             \EndIf
            \EndFor
          \EndIf
          \State EarlySquares.add( $h$ if no antecedents )
        \EndFor
    \Until EarlySquares == empty
    
    \EndFunction
  \end{algorithmic}
\end{algorithm}

\section*{Acknowledgements}
\anon
{Redacted for anonymity.} %Leave as-is
{ %Actual acknowledgement goes here.
I thank Thouis Ray Jones for suggesting this problem to me in 2012, and my institution for funding me.


{\tiny
My institution requires this disclaimer on all my publications, even though it handicaps its employees by preventing the author from making full use of the proceedings page limit. This technical article contains objective information and does not necessarily represent the subjective opinions of my institution. The authors are not authorized to communicate the policy of the institution. That said, my institution does not necessarily represent my views nor speak for me.\par
}
}

\end{document}

