Computes the Kronecker product of two matrices.

# S4 method for caracas_symbol,caracas_symbol
kronecker(X, Y, FUN = "*", make.dimnames = FALSE, ...)

Arguments

X, Y

matrices as caracas symbols.

FUN

a function; it may be a quoted string.

make.dimnames

Provide dimnames that are the product of the dimnames of ‘X’ and ‘Y’.

...

optional arguments to be passed to ‘FUN’.

Value

Kronecker product of A and B.

Examples

if (has_sympy()) {
  A <- matrix_sym(2, 2, "a")
  B <- matrix_sym(2, 2, "b")
  II <- matrix_sym_diag(2)
  EE <- eye_sym(2,2)
  JJ <- ones_sym(2,2)

  kronecker(A, B)
  kronecker(A, B, FUN = "+")
  kronecker(II, B)
  kronecker(EE, B)
  kronecker(JJ, B)
}
#> c: ⎡b₁₁  b₁₂  b₁₁  b₁₂⎤
#>    ⎢                  ⎥
#>    ⎢b₂₁  b₂₂  b₂₁  b₂₂⎥
#>    ⎢                  ⎥
#>    ⎢b₁₁  b₁₂  b₁₁  b₁₂⎥
#>    ⎢                  ⎥
#>    ⎣b₂₁  b₂₂  b₂₁  b₂₂⎦