如何用乳胶创建表格来可视化收缩期阵列

如何用乳胶创建表格来可视化收缩期阵列

我正在尝试创建一个表,该表必须可视化收缩阵列,如下图所示。脉动阵列

对于第一个一维线性数组,我写下:

    \begin{table}[]
    \begin{tabular}{l|l|l|l|l|l|l|l|l|l|l}
        \cline{2-2} \cline{4-4} \cline{6-6} \cline{8-8} \cline{10-10}
        \textbackslash{}\rightleftharpoons &  &  &  &  &  &  &  &  &  & \textbackslash{}\rightleftharpoons \\ \cline{2-2} \cline{4-4} \cline{6-6} \cline{8-8} \cline{10-10}
    \end{tabular}
\end{table}

我总是收到类似以下的错误信息:

在此处输入图片描述

我该如何修复错误信息?

答案1

使用tikz matrix

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}


\begin{document}

\begin{tikzpicture}[nodes in empty cells]
  \matrix(table)[
  matrix of nodes,
  row sep =2pt,
  column sep = 2pt,
  nodes={anchor=center,minimum height=0.5cm,minimum width=0.5cm, draw=black, fill=green},
  ] 
  {|[fill=none, draw=none]|$\rightleftharpoons$ & & & & & &|[fill=none, draw=none]|$\rightleftharpoons$\\
};
\end{tikzpicture}


\begin{tikzpicture}[nodes in empty cells]
  \matrix(table)[
  matrix of nodes,
  row sep =2pt,
  column sep = 2pt,
  nodes={anchor=center,minimum height=0.5cm,minimum width=0.5cm, draw=black, fill=green},
  row 1/.style = {nodes={fill=none, draw=none}},
  ] 
  {& $\downarrow$ & $\downarrow$ & $\downarrow$ & $\downarrow$ & $\downarrow$\\
  |[fill=none, draw=none]|$\rightleftharpoons$ & & & & & &|[fill=none, draw=none]|$\rightleftharpoons$\\
};
\end{tikzpicture}

\end{document}

答案2

另一个矩阵答案。它定义了一个图片

\pic{systolic array={<n>x<m>}};

绘制n x m矩阵。

\documentclass{article}
\usepackage{tikz}
\usepackage{etoolbox}
\usetikzlibrary{matrix}
\tikzset{gs/.style={rectangle,draw,fill=green!60!black,minimum width=1em,minimum
height=1em},inout/.style 2 args={
insert path={([yshift=-0.4ex]#1.#2) edge[-latex] ++(#2:1em)
([yshift=0.4ex]#1.#2) edge[latex-] ++(#2:1em) }},
systolicm/.style={matrix of nodes,nodes in empty cells,nodes={gs},column
sep=0.3ex,row sep=0.3ex},
pics/systolic array/.style args={#1x#2}{code={
\let\mymat\empty
\foreach \YY in {1,...,#2}
{\foreach \XX in {1,...,\the\numexpr#1-1}
{\begingroup\edef\tmp{\endgroup
       \noexpand\gappto\noexpand\mymat{\&}}\tmp
}
\gappto\mymat{\\}}
\matrix[systolicm,ampersand replacement=\&] (\pgfkeysvalueof{/tikz/systolic/name}) 
    {\mymat};
}},
systolic/.cd,name/.initial=smat
}
\begin{document}
\begin{tikzpicture}
\pic{systolic array={4x1}};
\draw [inout={smat-1-1}{180},inout={smat-1-4}{0}];
\end{tikzpicture}
\bigskip

\begin{tikzpicture}
\pic{systolic array={4x1}};
\draw [inout={smat-1-1}{180},inout={smat-1-4}{0}];
\draw foreach \X in {1,...,4}
{ (smat-1-\X.90) edge[latex-] ++ (90:1em)};
\end{tikzpicture}
\bigskip

\begin{tikzpicture}
\pic{systolic array={4x4}};
\draw foreach \X in {1,...,4}
{(smat-1-\X.90) edge[latex-] ++ (90:1em)
(smat-4-\X.-90) edge[latex-] ++ (-90:1em)
(smat-\X-1.180) edge[latex-] ++ (180:1em)
(smat-\X-4.0) edge[latex-] ++ (0:1em)};
\end{tikzpicture}
\bigskip

\begin{tikzpicture}
\pic{systolic array={4x4}};
\draw foreach \X in {1,...,4}
{(smat-1-\X.90) edge[latex-] ++ (90:1em)
(smat-4-\X.-90) edge[latex-] ++ (-90:1em)
(smat-\X-1.180) edge[latex-] ++ (180:1em)
(smat-\X-4.0) edge[latex-] ++ (0:1em)
foreach \Y in {1,...,4}
{(smat-\X-\Y.center) edge[latex-] ++(45:1em)} };
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容