\begin{tikzpicture}[ font=\scriptsize, tok/.style={draw, rounded corners=2pt, inner sep=2pt, minimum height=13pt, minimum width=20pt}, ev/.style={tok, fill=blue!12, thick}, od/.style={tok, fill=orange!30, dashed, thick}, grp/.style={draw, black!50, rounded corners=4pt, inner sep=3pt}, le/.style={semithick}, lo/.style={semithick, dashed}] \node[ev] (r1a) at (-0.45,0) {$\{0,1\}$}; \node[ev] (r1b) at (0.45,0) {$\{2,3\}$}; \node[od] (r2a) at (3.55,0) {$\{0,1,2\}$}; \node[od] (r2b) at (4.45,0) {$\{3\}$}; \node[ev] (r3a) at (7.1,0) {$\{0,1\}$}; \node[od] (r3b) at (7.95,0) {$\{2\}$}; \node[od] (r3c) at (8.7,0) {$\{3\}$}; \node[grp, fit=(r1a)(r1b), label={above:row $v = 1$}] {}; \node[grp, fit=(r2a)(r2b), label={above:row $v = 2$}] {}; \node[grp, fit=(r3a)(r3c), label={above:row $v = 3$}] {}; \node[ev] (c1a) at (-0.85,-2) {$\{0,1\}$}; \node[od] (c1b) at (0,-2) {$\{3\}$}; \node[od] (c1c) at (0.75,-2) {$\{2\}$}; \node[ev] (c2a) at (3.55,-2) {$\{2,3\}$}; \node[ev] (c2b) at (4.45,-2) {$\{0,1\}$}; \node[od] (c3a) at (7.55,-2) {$\{0,1,2\}$}; \node[od] (c3b) at (8.45,-2) {$\{3\}$}; \node[grp, fit=(c1a)(c1c), label={below:column $c = 1$}] {}; \node[grp, fit=(c2a)(c2b), label={below:column $c = 2$}] {}; \node[grp, fit=(c3a)(c3b), label={below:column $c = 3$}] {}; \draw[le] (r1a.south) -- (c1a.north); \draw[le] (r1b.south) -- (c2a.north); \draw[lo] (r2a.south) -- (c3a.north); \draw[lo] (r2b.south) -- (c1b.north); \draw[le] (r3a.south) -- (c2b.north); \draw[lo] (r3b.south) -- (c1c.north); \draw[lo] (r3c.south) -- (c3b.north); \node[ev, anchor=west] (le1) at (10.0,-0.55) {$B$}; \node[anchor=west] at (le1.east) {even $|B|$, variable $y_B$}; \node[od, anchor=west] (le2) at (10.0,-1.25) {$B$}; \node[anchor=west] at (le2.east) {odd $|B|$, variable $\theta_B$}; \node[anchor=west, align=left] at (9.95,0.2) {rows: factors of $P^N$}; \node[anchor=west, align=left] at (9.95,-2.0) {columns: factors of $Q^N$}; \node[anchor=west] at (-1.45,0.75) {(a)}; \node[anchor=west] at (-1.45,-3.35) {(b)}; \foreach \dx/\sw/\lab in {0.6/0/{as in (a): sign $\varepsilon$}, 5.6/1/{lines of type $\{3\}$ exchanged: sign $-\varepsilon$}} { \begin{scope}[xshift=\dx cm, yshift=-3.55cm] \node[od] (x2) at (0.6,0) {$\{3\}$}; \node[anchor=south, font=\tiny] at (x2.north) {row $2$}; \node[od] (x3) at (2.4,0) {$\{3\}$}; \node[anchor=south, font=\tiny] at (x3.north) {row $3$}; \node[od] (y1) at (0.6,-1.15) {$\{3\}$}; \node[anchor=north, font=\tiny] at (y1.south) {column $1$}; \node[od] (y3) at (2.4,-1.15) {$\{3\}$}; \node[anchor=north, font=\tiny] at (y3.south) {column $3$}; \ifnum\sw=0 \draw[lo] (x2.south) -- (y1.north); \draw[lo] (x3.south) -- (y3.north); \else \draw[lo] (x2.south) -- (y3.north); \draw[lo] (x3.south) -- (y1.north); \fi \node[anchor=north] at (1.5,-1.75) {\lab}; \end{scope} } \end{tikzpicture}