kronecker
The snippet can be accessed without any authentication.
Authored by
Jan Garbuszus
kronecker.R 393 B
> matrix(1:4, 2, 2)
[,1] [,2]
[1,] 1 3
[2,] 2 4
> mm <- matrix(1:4, 2, 2)
> s <- diag(2)
> kronecker(mm, s)
[,1] [,2] [,3] [,4]
[1,] 1 0 3 0
[2,] 0 1 0 3
[3,] 2 0 4 0
[4,] 0 2 0 4
> kronecker(s, mm)
[,1] [,2] [,3] [,4]
[1,] 1 3 0 0
[2,] 2 4 0 0
[3,] 0 0 1 3
[4,] 0 0 2 4
Please register or sign in to comment