A Kronecker product is simply a tensor product whose underlying vector
space basis is relabeled. In the present context this is realized
by combining multiple index labels into one. The associated dimension
to the new label is then simply the product of the dimensions associated
to the old index labels respectively.
Arguments
- x
A labeled tensor object, created by %_%
or tensor()
.
- ...
Any number of expressions (separated by a comma) of the form
.(<label1>, <label2>, ..., <labeln-1>) -> <labeln+1>
.
Value
A modified tensor object.
Examples
a <- array(1:8, dim = c(2, 2, 2))
a %_% .(i, j, k) |> kron(.(i, j) -> l)
#> <Labeled Array> [4x2] .(-l, -k)
#> [,1] [,2]
#> [1,] 1 5
#> [2,] 2 6
#> [3,] 3 7
#> [4,] 4 8