赞
踩
- % 伪代码 start
- \usepackage{algorithm}
- \usepackage{algpseudocode}
- \usepackage{amsmath}
- \renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
- \renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
- % 伪代码 end
位置
- \begin{algorithm}[h]
- \caption{Conjugate Gradient Algorithm with Dynamic Step-Size Control}
- \label{alg::conjugateGradient}
- \begin{algorithmic}[1]
- \Require
- $f(x)$: objective funtion;
- $x_0$: initial solution;
- $s$: step size;
- \Ensure
- optimal $x^{*}$
- \State initial $g_0=0$ and $d_0=0$;
- \Repeat
- \State compute gradient directions $g_k=\bigtriangledown f(x_k)$;
- \State compute Polak-Ribiere parameter $\beta_k=\frac{g_k^{T}(g_k-g_{k-1})}{\parallel g_{k-1} \parallel^{2}}$;
- \State compute the conjugate directions $d_k=-g_k+\beta_k d_{k-1}$;
- \State compute the step size $\alpha_k=s/\parallel d_k \parallel_{2}$;
- \Until{($f(x_k)>f(x_{k-1})$)}
- \end{algorithmic}
- \end{algorithm}
Latex写算法的伪代码排版_铭记_-CSDN博客_latex 伪代码
例子参考
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。