How to draw a matrix with some framed elements, and some arrows between two frames?
An all TiKZ
solution is easy with a matrix of math nodes
:
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (A) [matrix of math nodes, right delimiter = ), left delimiter =(] {
0 & & & & \\
a_1 & \ddots & & & \\
\vdots & & \ddots & & \\
a_2 & & & \ddots & \\
\vdots & b_1 & \ddots & & \\
\vdots & \vdots & & & \\
\vdots & b_2 & & & \\
\vdots & \vdots & c_1 & & \\
\vdots & \vdots & \vdots & & \\
\vdots & \vdots & c_2 & & \\
\vdots & \vdots & \vdots & & 0 \\
};
\draw[red] (A-2-1.north west) rectangle (A-4-1.south east);
\draw[red] (A-5-2.north west) rectangle (A-7-2.south east);
\draw[red] (A-8-3.north west) rectangle (A-10-3.south east);
\draw[->,blue] (A-4-1.south) --++(-90:1mm) -| (A-5-2.north);
\draw[->,blue] (A-7-2.south) --++(-90:1mm) -| (A-8-3.north);
\end{tikzpicture}
\end{document}
Adding some styles and using matrix
from PGF
can make this:
Code:
\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[
block/.style={text height=0.5em
, minimum width=1em,
, outer sep=0pt}]
\matrix [matrix of math nodes
, left delimiter={(},right delimiter={)}
, nodes in empty cells
, nodes=block
, row sep=1em
, column sep=1em] at (0,0)
{
0 & & & & & & & & & & \\
|(a1)| a_1 & \ddots & \\
\vdots & & \ddots & & & & & & & & \\
|(an)| a_n & & & & & & & & & & \\
\vdots & |(b1)| b_1 & & & & & & & & & \\
\vdots & \vdots & & & & & & & & & \\
\vdots & |(bn)| b_n & & & & & & & & & \\
\vdots & \vdots & |(c1)| c_1 & & & & & & & & \\
\vdots & \vdots & \vdots & & & & & & & & \\
\vdots & \vdots & |(cn)| c_n & & & & & & & & \\
\vdots & \vdots & \vdots & & & & & & & & 0 \\
};
\draw[dashed,red] (a1.north west) rectangle (an.south east);
\draw[dashed,red] (b1.north west) rectangle (bn.south east);
\draw[dashed,red] (c1.north west) rectangle (cn.south east);
\draw[-latex,blue] (an.south) --++(-90:1mm) -| (b1.north);
\draw[-latex,blue] (bn.south) --++(-90:1mm) -| (c1.north);
\end{tikzpicture}
\end{document}