Tensors can be put side by side in one dimension if they are of equal size in all other dimensions.

bind.tensor(A,dA=NULL,B,dB=dA)

Arguments

A

the first tensor

dA

the dimension of A to be used for binding the tensors

B

the second tensor

dB

the dimension of B to be used for binding the tensors

Value

a tensor with the tensors combined to one

Details

This function works like a cbind or rbind function for tensors.

Note

binding does not preserve the sequence of the dimensions.

See also

base{cbind}

Author

K.Gerald van den Boogaart

Examples

  A <- to.tensor(1:6,c(a=2,b=3))
bind.tensor(A,"a",A)
#>       a
#> b      [,1] [,2] [,3] [,4]
#>   [1,]    1    2    1    2
#>   [2,]    3    4    3    4
#>   [3,]    5    6    5    6
#> attr(,"class")
#> [1] "tensor" "matrix"
bind.tensor(A,"b",A)
#>       b
#> a      [,1] [,2] [,3] [,4] [,5] [,6]
#>   [1,]    1    3    5    1    3    5
#>   [2,]    2    4    6    2    4    6
#> attr(,"class")
#> [1] "tensor" "matrix"