kronecker
From base v3.3
by Rcore Rcore@Rproject.org
Kronecker Products on Arrays
Computes the generalised kronecker product of two arrays,
X
and Y
.
 Keywords
 array
Usage
kronecker(X, Y, FUN = "*", make.dimnames = FALSE, ...)
X %x% Y
Arguments
 X
 A vector or array.
 Y
 A vector or array.
 FUN
 a function; it may be a quoted string.
 make.dimnames
 Provide dimnames that are the product of the
dimnames of
X
andY
.  ...
 optional arguments to be passed to
FUN
.
Details
If X
and Y
do not have the same number of
dimensions, the smaller array is padded with dimensions of size
one. The returned array comprises submatrices constructed by
taking X
one term at a time and expanding that term as
FUN(x, Y, ...)
.
%x%
is an alias for kronecker
(where
FUN
is hardwired to "*"
).
Value

An array A with dimensions dim(X) * dim(Y).
References
Shayle R. Searle (1982) Matrix Algebra Useful for Statistics. John Wiley and Sons.
See Also
outer
, on which kronecker
is built
and %*%
for usual matrix multiplication.
Examples
library(base)
# simple scalar multiplication
( M < matrix(1:6, ncol = 2) )
kronecker(4, M)
# Block diagonal matrix:
kronecker(diag(1, 3), M)
# ask for dimnames
fred < matrix(1:12, 3, 4, dimnames = list(LETTERS[1:3], LETTERS[4:7]))
bill < c("happy" = 100, "sad" = 1000)
kronecker(fred, bill, make.dimnames = TRUE)
bill < outer(bill, c("cat" = 3, "dog" = 4))
kronecker(fred, bill, make.dimnames = TRUE)
Community examples
Looks like there are no examples yet.