Last active
August 29, 2015 13:56
-
-
Save stormxuwz/9225226 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usepackage[subsection]{algorithm} % algorithm float, number according to subsection | |
\usepackage{algpseudocode} % pseudo-code format | |
\begin{algorithm}[htbp] | |
\caption{Parallel CUDA algorithm for connect component labelling \#1} | |
\label{alg:imageLabellingGPU1} | |
\algblockdefx[kernel]{Kernel}{EndKernel}[2][default value]{{\bf kernel} {\footnotesize \uppercase{#1}(#2)}}{\bf end kernel} | |
\begin{algorithmic} | |
%\State Global variable: isChanged=true; | |
\Function{gpu\_labelling\_1}{} | |
\While{$isChanged=true$} | |
\State run kernel ROW on rows | |
\State run kernel COLUMN on columns | |
\EndWhile | |
\EndFunction | |
\end{algorithmic} | |
\hrule | |
\begin{algorithmic} | |
\Kernel[row]{$\bf x$} \Comment labells each pixel connected in a row with the smallest of their indices | |
\For{$k=1$ to $n$} | |
\For{$j=k$ to $n$} | |
\State $tmp=\sum{i=1}{k}L_{i,j}\times L_{i,k}$ | |
\If{$j==k$} | |
\State $L_{k,j}=\sqrt{A_{k,j}-tmp}$ | |
\Else | |
\State $L_{k,j}=(A_{k,j}-tmp)/L_{k,k}$ | |
\EndIf | |
\EndFor | |
\EndFor | |
\EndKernel | |
\end{algorithmic} | |
\end{algorithm} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pseudo code in latex