IEEE Trans latex algorithm format

\documentclass{IEEEtran}
\usepackage{algorithm,algorithmic}
\begin{document}
\begin{algorithm}
\caption{Algorithm for …}
\begin{algorithmic}[1]
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\REQUIRE in
\ENSURE out
\ \textit{Initialisation} :
\STATE first statement
\ \textit{LOOP Process}
\FOR { i = l − 2 i = l-2 i=l2 to 0 0 0}
\STATE statements…
\IF {( i ≠ 0 i \ne 0 i=0)}
\STATE statement…
\ENDIF
\ENDFOR
\RETURN P P P
\end{algorithmic}
\end{algorithm}

\end{document}

下面是algorithm format in ieee latex template
\begin{algorithm}[H]
\caption{Loacal search for phase shift}\label{alg:alg1}
\begin{algorithmic}
\STATE $ \textbf{Input} $
\STATE $ \textbf{Output}$ $ \theta $
\STATE {\textsc{TRAIN}} ( X T ) (\mathbf{X} \mathbf{T}) (XT)
\STATE \hspace{0.5cm}$ \textbf{select randomly } W \subset \mathbf{X} $
\STATE \hspace{0.5cm}$ N_\mathbf{t} \gets | { i : \mathbf{t}i = \mathbf{t} } | $ \textbf{ for } $ \mathbf{t}= -1,+1 $
\STATE \hspace{0.5cm}$ B_i \gets \sqrt{ \textsc{max}(N
{-1},N_{+1}) / N_{\mathbf{t}_i} } $ \textbf{ for } $ i = 1,…,N $
\STATE \hspace{0.5cm}$ \hat{\mathbf{H}} \gets B \cdot (\mathbf{X}^T\textbf{W})/( \mathbb{1}\mathbf{X} + \mathbb{1}\textbf{W} - \mathbf{X}^T\textbf{W} ) $
\STATE \hspace{0.5cm}$ \beta \gets \left ( I/C + \hat{\mathbf{H}}^T\hat{\mathbf{H}} \right ){-1}(\hat{\mathbf{H}}T B\cdot \mathbf{T}) $
\STATE \hspace{0.5cm}\textbf{return} $\textbf{W}, \beta $
\STATE
\STATE {\textsc{PREDICT}} ( X ) (\mathbf{X} ) (X)
\STATE \hspace{0.5cm}$ \mathbf{H} \gets (\mathbf{X}^T\textbf{W} )/( \mathbb{1}\mathbf{X} + \mathbb{1}\textbf{W}- \mathbf{X}^T\textbf{W} ) $
\STATE \hspace{0.5cm}\textbf{return} KaTeX parse error: Undefined control sequence: \textsc at position 1: \̲t̲e̲x̲t̲s̲c̲{sign}( \mathbf…
\end{algorithmic}
\label{alg1}
\end{algorithm}

你可能感兴趣的:(笔记)