r-cas / caracas

Computer algebra in R
GNU General Public License v2.0
24 stars 2 forks source link

Kronecker Products on Arrays / tensor products #35

Open mikldk opened 3 years ago

mikldk commented 1 year ago

library(caracas) A <- matrix_sym(2, 2, "a") B <- matrix_sym(2, 2, "b") tensor <- function(A, B) { s <- get_sympy() caracas::eval_to_symbol(s$tensorproduct(A$pyobj, B$pyobj)) } AB <- tensor(A, B) AB matrify(eval_to_symbol(AB$pyobj[[1]][[1]]))