Form the direct product of the \(m \times n\) matrix
A and the \(p \times q\) matrix
B.
It is also called the Kroneker product and the right direct product.
It is defined to be the result of replacing each element of
A, \(a_{ij}\), with \(a_{ij}\bold{B}\).
The result matrix
is \(mp \times nq\).
The method employed uses the rep
function to form two
\(mp \times nq\) matrices: (i) the direct
product of A and J, and (ii) the direct product of
J and B, where each J is a matrix of ones
whose dimensions are those required to produce an
\(mp \times nq\) matrix. Then the
elementwise product of these two matrices is taken to yield the result.