matrixcalc (version 1.0-3)

direct.prod: Direct prod of two arrays

Description

This function computes the direct product of two arrays. The arrays can be numerical vectors or matrices. The result is a matrix.

Usage

direct.prod( x, y )

Arguments

x

a numeric matrix or vector

y

a numeric matrix or vector

Value

A numeric matrix.

Details

If either \(\bf{x}\) or \(\bf{y}\) is a vector, it is converted to a matrix. Suppose that \(\bf{x}\) is an \(m \times n\) matrix and \(\bf{y}\) is an \( p \times q\) matrix. Then, the function returns the matrix \(\left[ {\begin{array}{*{20}{c}} {{x_{1,1}}\;{\bf{y}}}&{{x_{1,2}}\;{\bf{y}}}& \cdots &{{x_{1,n}}\;{\bf{y}}}\\ {{x_{2,1}}\;{\bf{y}}}&{{x_{2,2}}\;{\bf{y}}}& \cdots &{{x_{2,n}}\;{\bf{y}}}\\ \cdots & \cdots & \cdots & \cdots \\ {{x_{m,1}}\;{\bf{y}}}&{{x_{m,2}}\;{\bf{y}}}& \cdots &{{x_{m,n}}\;{\bf{y}}} \end{array}} \right]\).

References

Magnus, J. R. and H. Neudecker (1999) Matrix Differential Calculus with Applications in Statistics and Econometrics, Second Edition, John Wiley.

Examples

Run this code
# NOT RUN {
x <- matrix( seq( 1, 4 ) )
y <- matrix( seq( 5, 8 ) )
print( direct.prod( x, y ) )
# }

Run the code above in your browser using DataLab