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 $\bA $ and $\bB $, the direct product is denoted by $\bA \otimes \bB $. 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 $\bA $ is an $n\times p$ matrix and $\bB $ is a $m\times q$ matrix, then the Kronecker product $\bA \otimes \bB $ is the following $nm\times pq$ block matrix:

\[ \bA \otimes \bB = \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 25.9:

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

Figure 25.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).