kronecker {base} | R Documentation |
Computes the generalised kronecker product of two arrays,
X
and Y
. kronecker(X, Y)
returns an array
A
with dimensions dim(X) * dim(Y)
.
kronecker(X, Y, FUN = "*", ...) X %x% Y
X |
vector or array. |
Y |
vector or array. |
FUN |
a function, possibly specified as character (string). |
... |
optional arguments to be passed to FUN . |
If X
and Y
do not have the same number of dimensions,
the smaller array is padded with dimensions of size one. A
consists of 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 "*"
).
Jonathan Rougier
Searle, Shayle R. (1982) Matrix Algebra Useful for Statistics; John Wiley and Sons.
outer
on which kronecker
is built and
matmult
for usual matrix multiplication.
# simple scalar multiplication ( M <- matrix(1:6, ncol=2) ) all(kronecker(4, M) == 4 * M) ( A <- matrix(0:3, ncol=2) ) A %x% cbind(2:3) # Block diagonal array: kronecker(diag(3), M) all(kronecker(diag(3), M) == diag(3) %x% M)