Tensor products of Matrices.
See also
vignette("cnr", package = "cpr")
for details on tensor products.
Examples
A <- matrix(1:4, nrow = 10, ncol = 20)
B <- matrix(1:6, nrow = 10, ncol = 6)
# Two ways of building the same tensor product
tensor1 <- build_tensor(A, B)
tensor2 <- do.call(build_tensor, list(A, B))
all.equal(tensor1, tensor2)
#> [1] TRUE
# a three matrix tensor product
tensor3 <- build_tensor(A, B, B)
str(tensor3)
#> num [1:10, 1:720] 1 8 27 64 25 72 3 16 9 32 ...