打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Latex 如何书写算法流程

最近要在论文中写算法流程, 幸好看到一个latex版本, 借此机会学习下。

代码如下:

  1. %\dontprintsemicolon%doesn't work on my machine  
  2. \SetCommentSty{textit}  
  3. \SetKwComment{tcc}{}{} %default /* */  
  4. \SetSideCommentRight  
  5. \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}  
  6. \Input{Signal to be filtered $f_1:\Sigma\rightarrow\R^n$\\Cross bilateral function $f_2:\Sigma\rightarrow\Gamma$\\Samples $\p_1,\ldots,\p_m\in\Gamma$\\Partition of unity $\phi_1,\ldots,\phi_m:\Gamma\rightarrow\R$}  
  7. \Output{Filtered signal $\bar{f}:\Sigma\rightarrow\R^n$}  
  8. \BlankLine  
  9. $\bar{f}^{num}(\x), \bar{f}^{den}(\x)\leftarrow0\,\forall\x\in\Sigma$\tcc*[r]{Initialization}  
  10. \For{$i=1\textrm{ to }m$}{  
  11. $g^{num}(\x)\leftarrow f_1(\x)K_\Gamma(f_2(\x),\p_i)$\tcc*[r]{Weight signals}  
  12. $g^{den}(\x)\leftarrow K_\Gamma(f_2(\x),\p_i)$\;  
  13. $\hat{g}^{num}(\x)\leftarrow \mathbf{T}[g^{num}](\x)$\tcc*[r]{Apply blur operator}  
  14. $\hat{g}^{den}(\x)\leftarrow \mathbf{T}[g^{den}](\x)$\;  
  15. $\bar{f}^{num}(\x)\leftarrow \bar{f}^{num}(\x)$\nosemic\tcc*[r]{Collect}  
  16. \dosemic$\hspace{.75in}+ \hat{g}^{num}(\x)\phi_i(f_2(\x))$\;  
  17. $\bar{f}^{den}(\x)\leftarrow \bar{f}^{den}(\x) + \hat{g}^{den}(\x)\phi_i(f_2(\x))$\;  
  18. }  
  19. $\bar{f}(\x)\leftarrow \nicefrac{\bar{f}^{num}(\x)}{\bar{f}^{den}(\x)}$\tcc*[r]{Normalize}\vspace{.025in}  
  20. \caption{Generalized bilateral filtering algorithm\vspace{-.2in}}\label{alg:generalized}  
  21. \end{algorithm}  


效果图:

以后可以大胆用啦 微笑 呵呵 笑


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
LaTex 稿整理:捕捉等高性
latex
这9个程序员工具网站,太牛了吧
LaTeX中的数学公式的初步使用
latex 双引号
​Tips 回顾
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服