Here is my version. With some tweaking, it can be made efficient.
\begin{tikzpicture}
\matrix [matrix of math nodes,left delimiter=(,right delimiter=),row sep=0.5cm,column sep=0.5cm] (m) {
1&2&3&4 \\
1&2&3&4 \\
1&2&3&4 \\
1&2&3&4 \\};
\draw[dashed] ($0.5*(m-1-2.north east)+0.5*(m-1-3.north west)$) --
($0.5*(m-4-2.south east)+0.5*(m-4-3.south west)$);
\draw[dashed] ($0.5*(m-2-1.south west)+0.5*(m-3-1.north west)$) --
($0.5*(m-2-4.south east)+0.5*(m-3-4.north east)$);
\node[above=10pt of m-1-1] (top-1) {a};
\node[above=10pt of m-1-2] (top-2) {b};
\node[above=10pt of m-1-3] (top-3) {c};
\node[above=10pt of m-1-4] (top-4) {d};
\node[left=12pt of m-1-1] (left-1) {$\alpha$};
\node[left=12pt of m-2-1] (left-2) {$\beta$};
\node[left=12pt of m-3-1] (left-3) {$\gamma$};
\node[left=12pt of m-4-1] (left-4) {$\delta$};
\node[rectangle,above delimiter=\{] (del-top-1) at ($0.5*(top-1.south) +0.5*(top-2.south)$) {\tikz{\path (top-1.south west) rectangle (top-2.north east);}};
\node[above=10pt] at (del-top-1.north) {$A$};
\node[rectangle,above delimiter=\{] (del-top-2) at ($0.5*(top-3.south) +0.5*(top-4.south)$) {\tikz{\path (top-3.south west) rectangle (top-4.north east);}};
\node[above=10pt] at (del-top-2.north) {$B$};
\node[rectangle,left delimiter=\{] (del-left-1) at ($0.5*(left-1.east) +0.5*(left-2.east)$) {\tikz{\path (left-1.north east) rectangle (left-2.south west);}};
\node[left=10pt] at (del-left-1.west) {$C$};
\node[rectangle,left delimiter=\{] (del-left-2) at ($0.5*(left-3.east) +0.5*(left-4.east)$) {\tikz{\path (left-3.north east) rectangle (left-4.south west);}};
\node[left=10pt] at (del-left-2.west) {$D$};
\end{tikzpicture}
The result is

Answer to comment :
One way to incorporate the math signs is to place everything in nodes. You could also place the matrices within boxes and include them in an equation, but this approach is tricky and delicate. As an example, just insert the following code after my initial code, before the \end{tikzpicture}
:
\node[right=of m] (op) {$\times$};
\matrix [right=of op,matrix of math nodes,left delimiter=(,right delimiter=),row sep=0.5cm,column sep=0.5cm] (n) {
1&2 \\
1&2 \\
};
\node[above=10pt of n-1-1] {a};
\node[above=10pt of n-1-2] {b};
\node[left=12pt of n-1-1] {$\alpha$};
\node[left=12pt of n-2-1] {$\beta$};
You have to collect the row beforehand, as doing it inside an array environment is quite difficult, as TeX ends a cell as soon as it sees an &
. I prefer to do in with a token register and the \count255
scratch counter.
We collect two arguments: the first is the number of entries, the second the first entry, in order to initialize the token register with it. We set the counter to the number of requested element (since we have already collected one, we step it down immediately).
Then we start the recursion; the macro \rowvectnexta
examines the value of the counter; if it's still greater than 0, it calls \rowvecnextb
that gathers another argument, stores it into the token register (adding an &
) and steps down the counter; otherwise it builds the pmatrix
by releasing the contents of the register.
\newtoks\rowvectoks
\newcommand{\rowvec}[2]{%
\rowvectoks={#2}\count255=#1\relax
\advance\count255 by -1
\rowvecnexta}
\newcommand{\rowvecnexta}{%
\ifnum\count255>0
\expandafter\rowvecnextb
\else
\begin{pmatrix}\the\rowvectoks\end{pmatrix}
\fi}
\newcommand\rowvecnextb[1]{%
\rowvectoks=\expandafter{\the\rowvectoks}%
\advance\count255 by -1
\rowvecnexta}
It shouldn't be a big limitation the fact that you need at least one element:
\rowvec{1}{a}
\rowvec{2}{a}{b}
\rowvec{3}{a}{b}{c}
Notice: \usepackage{amsmath}
is required. So a minimal example might be the following.
\documentclass{article}
\usepackage{amsmath}
\newtoks\rowvectoks
\newcommand{\rowvec}[2]{%
\rowvectoks={#2}\count255=#1\relax
\advance\count255 by -1
\rowvecnexta}
\newcommand{\rowvecnexta}{%
\ifnum\count255>0
\expandafter\rowvecnextb
\else
\begin{pmatrix}\the\rowvectoks\end{pmatrix}
\fi}
\newcommand\rowvecnextb[1]{%
\rowvectoks=\expandafter{\the\rowvectoks}%
\advance\count255 by -1
\rowvecnexta}
\begin{document}
$\rowvec{1}{a}$
$\rowvec{2}{a}{b}$
$\rowvec{3}{a}{b}{c}$
\end{document}
A completely different solution that can be generalized to column vectors uses xparse
and LaTeX3.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\Rowvec}{ O{,} m }
{
\vector_main:nnnn { p } { & } { #1 } { #2 }
}
\NewDocumentCommand{\Colvec}{ O{,} m }
{
\vector_main:nnnn { p } { \\ } { #1 } { #2 }
}
\seq_new:N \l__vector_arg_seq
\cs_new_protected:Npn \vector_main:nnnn #1 #2 #3 #4
{
\seq_set_split:Nnn \l__vector_arg_seq { #3 } { #4 }
\begin{#1matrix}
\seq_use:Nnnn \l__vector_arg_seq { #2 } { #2 } { #2 }
\end{#1matrix}
}
\ExplSyntaxOff
\begin{document}
$\Rowvec{a}\Rowvec{a,b}\Rowvec[;]{a;b;c}$
$\Colvec{a}\Colvec{a,b}\Colvec[;]{a;b;c}$
\end{document}
The optional argument is the delimiter to be used to separate entries in the list given as argument.
It's sufficient to change { p }
into { b }
in the two main definitions to get brackets instead of parentheses.

Note: this requires expl3
dated September 2012 or later.
Best Answer
You can use rules to create the vertical and horizontal bars and then just put them into your array directy.