您当前的位置: 首页 > 
  • 0浏览

    0关注

    1477博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

latex 伪代码

软件工程小施同学 发布时间:2021-10-31 23:17:57 ,浏览量:0

% 伪代码 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 伪代码

例子参考

Latex算法伪代码使用总结 - Tsingke - 博客园Latex伪代码使用总结 algorithmicx例子 相应代码: [plain] view plain copy \documentclass[11pt]{ctexart} \uhttps://www.cnblogs.com/tsingke/p/6510343.html

关注
打赏
1665320866
查看更多评论
立即登录/注册

微信扫码登录

0.0390s