Commit e50b89be authored by rusty1s's avatar rusty1s
Browse files

fixed template

parent 722b7cb7
\documentclass[class=minimal]{standalone} \def\indices{{0, 0, 1, 0, 2, 2, 3, 3}}
\def\inputs{{5, 1, 7, 2, 3, 2, 1, 3}}
\usepackage{tikz} \def\outputs{{8, 7, 5, 4}}
\usetikzlibrary{shapes.geometric} \def\colors{{"cyan", "orange", "olive", "magenta"}}
\newcommand{\tiny}[1]{\scalebox{0.45}{#1}}
\def\index{{0, 0, 1, 0, 2, 2, 3, 3}}
\def\input{{5, 1, 7, 2, 3, 2, 1, 3}}
\def\output{{8, 7, 5, 4}}
\def\color{{"cyan", "orange", "olive", "magenta"}}
\def\numberInputs{7} \def\numberInputs{7}
\def\numberOutputs{3} \def\numberOutputs{3}
\def\operation{+} \def\operation{add}
\begin{document}
\input{template} \input{template}
\end{document}
\documentclass[class=minimal]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\newcommand{\tiny}[1]{\scalebox{0.45}{#1}}
\begin{document}
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{title}=[text width=1.1cm, inner sep=0pt] \tikzstyle{title}=[text width=1.1cm, inner sep=0pt]
\tikzstyle{square}=[rectangle, draw, minimum width=0.5cm, minimum height=0.5cm, inner sep=0pt, fill opacity=0.5, text opacity=1] \tikzstyle{square}=[rectangle, draw, minimum width=0.5cm, minimum height=0.5cm, inner sep=0pt, fill opacity=0.5, text opacity=1]
\tikzstyle{op}=[ellipse, draw, inner sep=-1pt, minimum height=8pt, minimum width=8pt] \tikzstyle{op}=[ellipse, draw, inner sep=0pt, minimum height=8pt, minimum width=8pt]
\tikzstyle{edge1}=[->] \tikzstyle{edge}=[->]
\tikzstyle{edge2}=[out=-90, in=90, looseness=0.85] \tikzstyle{round}=[out=-90, in=90, looseness=0.85]
\node[title] at (-0.8, 2.2) {index}; \node[title] at (-0.8, 2.2) {index};
\node[title] at (-0.8, 1.5) {input}; \node[title] at (-0.8, 1.5) {input};
\foreach \i in {0,...,\numberInputs} { \foreach \i in {0,...,\numberInputs} {
\pgfmathparse{\index[\i]}\let\idx\pgfmathresult \pgfmathparse{\indices[\i]}\let\idx\pgfmathresult
\pgfmathparse{\input[\i]}\let\in\pgfmathresult \pgfmathparse{\inputs[\i]}\let\in\pgfmathresult
\pgfmathparse{\color[\idx]}\let\co\pgfmathresult \pgfmathparse{\colors[\idx]}\let\co\pgfmathresult
\node[square] (index\i) at (\i * 0.5, 2.2) {\idx}; \node[square] (index\i) at (\i * 0.5, 2.2) {\idx};
\node[square, fill=\co] (input\i) at (\i * 0.5, 1.5) {\in}; \node[square, fill=\co] (input\i) at (\i * 0.5, 1.5) {\in};
\draw[edge1] (index\i) -- (input\i); \draw[edge] (index\i) -- (input\i);
} }
\node[title] at (-0.8, 0.0) {output}; \node[title] at (-0.8, 0.0) {output};
\foreach \i in {0,...,\numberOutputs} { \foreach \i in {0,...,\numberOutputs} {
\pgfmathparse{\output[\i]}\let\out\pgfmathresult \pgfmathparse{\outputs[\i]}\let\out\pgfmathresult
\pgfmathparse{\color[\i]}\let\co\pgfmathresult \pgfmathparse{\colors[\i]}\let\co\pgfmathresult
\def \x{(\numberInputs - \numberOutputs) * 0.25 + \i * 0.5} \def \x{(\numberInputs - \numberOutputs) * 0.25 + \i * 0.5}
\node[op] (op\i) at ({\x}, 0.6) {\tiny{\operation}}; \node[op] (op\i) at ({\x}, 0.6) {\tiny{\operation}};
\node[square, fill=\co] (output\i) at ({\x}, 0.0) {\out}; \node[square, fill=\co] (output\i) at ({\x}, 0.0) {\out};
\draw[edge1] (op\i) -- (output\i); \draw[edge] (op\i) -- (output\i);
} }
\foreach \i in {0,...,\numberInputs} { \foreach \i in {0,...,\numberInputs} {
\pgfmathparse{\index[\i]}\let\idx\pgfmathresult \pgfmathparse{\indices[\i]}\let\idx\pgfmathresult
\draw[edge1] (input\i) to[edge2] (op\idx); \draw[edge] (input\i) to[round] (op\idx);
} }
\end{tikzpicture} \end{tikzpicture}
\end{document}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment