Language Reference


Direct Product Operator:   @

  • matrix1 @ matrix2;

The direct product operator (@) computes a new matrix that is the direct product (also called the Kronecker product) of matrix1 and matrix2. For matrices $\mb{A}$ and $\mb{B}$, the direct product is denoted by $\mb{A} \otimes \mb{B}$. The number of rows in the new matrix equals the product of the number of rows in matrix1 and the number of rows in matrix2; the number of columns in the new matrix equals the product of the number of columns in matrix1 and the number of columns in matrix2.

Specifically, if $\mb{A}$ is an $n\times p$ matrix and $\mb{B}$ is a $m\times q$ matrix, then the Kronecker product $\mb{A}\otimes \mb{B}$ is the following $nm\times pq$ block matrix:

\[  \mb{A}\otimes \mb{B}= \left[ \begin{matrix}  A_{11} B   &  \cdots   &  A_{1p}B   \cr \vdots   &  \ddots   &  \vdots   \cr A_{n1} B   &  \cdots   &  A_{np} B   \end{matrix} \right]  \]

For example, the following statements compute the matrices c and d, which are shown in Figure 24.9:

a = {1 2,
     3 4};
b = {0 2};
c = a@b;
d = b@a;
print c, d;

Figure 24.9: Results of Direct Product Computation

c
0 2 0 4
0 6 0 8

d
0 0 2 4
0 0 6 8



Notice that the direct product of two matrices is not commutative.

The direct product is used in several areas of statistics. For example, in complete balanced designs the sums of squares and the covariance matrices can be expressed in terms of direct products (Hocking, 1985).