R/lin_alg_advanced.R
kronecker-caracas_symbol-caracas_symbol-method.Rd
Computes the Kronecker product of two matrices.
# S4 method for caracas_symbol,caracas_symbol
kronecker(X, Y, FUN = "*", make.dimnames = FALSE, ...)
matrices as caracas symbols.
a function; it may be a quoted string.
Provide dimnames that are the product of the dimnames of ‘X’ and ‘Y’.
optional arguments to be passed to ‘FUN’.
Kronecker product of A and B.
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₂₂⎦