Skip to content
Snippets Groups Projects

kronecker

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    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
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment