-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathfigure6-3-a-convolution.tex
More file actions
65 lines (52 loc) · 1.78 KB
/
figure6-3-a-convolution.tex
File metadata and controls
65 lines (52 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
\documentclass[tikz, border=50pt]{standalone}
\usepackage{tikz}
\usepackage{medl_colors}
\usepackage{amsmath,xstring}
\usepackage{ifthen}
\usetikzlibrary{shapes.multipart, shapes.geometric, arrows.meta}
\usetikzlibrary{matrix, calc, positioning,fit, backgrounds}
\begin {document}
\begin{tikzpicture}[every node/.style={minimum size=1cm},on grid]
\begin{scope}
\newcommand\slantarray[5]{
\foreach \i in {1,...,#3}{
\foreach \j in {1,...,#4}{
\node (node-#5\i\j) at (#1+\i-.5, #2-\j+.5) {$#5_{\j,\i}$};
}
}
\draw[thickline] (#1,#2) grid[step=1] (#1+#3, #2-#4);
}
\newcommand\fillbg[6]{
\begin{scope}[on background layer]
\node[greyshape,thickline, minimum size=1cm,fill=#5, fill opacity=0.65] at (#1+.5+#3,#2-.5-#4){#6};
\end{scope}
}
\newcommand\lines[6]{
\draw[#4, ultra thick, opacity=#6] (#1,#2) -- (#1+#3,#2);
\draw[#4, ultra thick, opacity=#6] (#1+#3,#2) -- (#1+#3,#2-#3);
\draw[#4, ultra thick, opacity=#6] (#1+#3,#2-#3) -- (#1,#2-#3);
\draw[#4, ultra thick, opacity=#6] (#1,#2-#3) -- (#1,#2);
\pgfmathparse{int(#3-1)} \edef\prev{\pgfmathresult};
\foreach \i in {0,...,\prev}{
\foreach \j in {0,...,\prev}{
\fillbg{#1}{#2}{\i}{\j}{#5}{}
}
}
}
\slantarray{5}{0}{7}{6}{x};
\begin{scope}[yshift=.5cm]
\slantarray{0}{-2}{3}{3}{w};
\end{scope}
\slantarray{14}{-1}{5}{4}{z};
\lines{5}{0}{3}{border-green}{fill-light-green}{1}
\lines{6}{0}{3}{border-red}{fill-light-red}{.4}
\lines{14}{-1}{1}{border-green}{fill-light-green}{1}
\lines{15}{-1}{1}{border-red}{fill-light-red}{.4}
\node at (1.5,-5) { \Large $W$};
\node at (8.5,-6.5) { \Large $ x$};
\node at (16.5,-5.5) {\Large $z$};
\node at (4,-3) {\Large $\star$};
\node at (13,-3) {\Large $ =$};
\end{scope}
\end{tikzpicture}
\end{document}