latex---插入三线表&伪代码流程图

我想实现下述伪代码算法,注意不同于三线表哦

1 三线表要记得加入这个“宏包”

粗细可调: https://blog.csdn.net/lishoubox/article/details/7331653

\usepackage{booktabs}

表格

\begin{table}[htbp]
 \caption{\label{tab:test}示例表格}  %标题
 \begin{tabular}{lcl} %三列,居左,中,左
   \toprule %第一条线
   a11 & a12 & a13 \\
   \midrule %第二条线
   a21 & a22 & a23 \\
   a31 & a32 & a33 \\
   \bottomrule %第三条线
 \end{tabular}
\end{table}

\begin{table}[htbp]
 \caption{\label{tab:test}示例表格}  %标题
 \begin{tabular}{lcl} %三列,居左,中,左
   \toprule %第一条线
   a11 & a12 & a13 \\
   \midrule %第二条线
   a21 & a22 & a23 \\
   a31 & a32 & a33 \\
   \bottomrule %第三条线
 \end{tabular}
\end{table}

2 伪代码:

宏包+算法: https://www.cnblogs.com/52ml/p/3823802.html

多种伪代码格式以及宏包: https://blog.csdn.net/lwb102063/article/details/53046265

扫描二维码关注公众号,回复: 9244931 查看本文章

https://blog.csdn.net/lwb102063/article/details/53046265

for循环
与if条件句

\For{$i=1;i\leq N;i\leftarrow i+1$}
      \If {$i=N$}
                    \State $middle \gets (left + right) / 2$
                    \State $result \gets result +$ \Call{MergerSort}{$Array, left, middle$}
                    \State $result \gets result +$ \Call{MergerSort}{$Array, middle, right$}
                    \State $result \gets result +$ \Call{Merger}{$Array,left,middle,right$}
      \EndIf 

      \State $d^{3}, d^{4}, d^{5} = D_{d_{3}}(f_{s}^{2}), D_{d_{4}}(f_{s}^{2}), D_{d_{5}}(f_{s}^{2})$ ;
      \State $f_{s}^{2}, f_{s}^{3}, f_{s}^{4}, f_{s}^{5} = D_{f_{i}}(f_{s}^{2}, f_{s}^{3}+d^{3}, f_{s}^{4}+d^{4}, f_{s}^{5}+d^{5});$
      \State $m^{2}, m^{3}, m^{4}, m^{5} = Conv_{2}(f_{s}^{2}), Conv_{3}(f_{s}^{3}), Conv_{4}(f_{s}^{4}), Conv_{5}(f_{s}^{5});$
    \EndFor

宏包:前期准备

\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 

  \begin{algorithm}[htb]  
  \caption{ Framework of ensemble learning for our system.}  
  \label{alg:Framwork}  
  \begin{algorithmic}[1]  
    \Require  
      The set of positive samples for current batch, $P_n$;  
      The set of unlabelled samples for current batch, $U_n$;  
      Ensemble of classifiers on former batches, $E_{n-1}$;  
    \Ensure  
      Ensemble of classifiers on the current batch, $E_n$;  
    \State Extracting the set of reliable negative and/or positive samples $T_n$ from $U_n$ with help of $P_n$;  
    \label{code:fram:extract}  
    \State Training ensemble of classifiers $E$ on $T_n \cup P_n$, with help of data in former batches;  
    \label{code:fram:trainbase}  
    \State $E_n=E_{n-1}cup E$;  
    \label{code:fram:add}  
    \State Classifying samples in $U_n-T_n$ by $E_n$;  
    \label{code:fram:classify}  
    \State Deleting some weak classifiers in $E_n$ so as to keep the capacity of $E_n$;  
    \label{code:fram:select} \\  
    \Return $E_n$;  
  \end{algorithmic}  
\end{algorithm}  
发布了458 篇原创文章 · 获赞 138 · 访问量 24万+

猜你喜欢

转载自blog.csdn.net/zjc910997316/article/details/104228177