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 and , the direct product is denoted by . 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 is an matrix and is a matrix, then the Kronecker product is the following block matrix:
For example, the following statements compute the matrices c
and d
, which are shown in Figure 23.9:
a = {1 2, 3 4}; b = {0 2}; c = a@b; d = b@a; print c, d;
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).