to.matrix.tensor {tensorA} | R Documentation |
The matrix corresponding to a tensor seen as a linear mapping of tensors.
Description
A tensor can be seen as a linear mapping of a tensor to a tensor. This function gives the corresponding matrix of the mapping.
Usage
to.matrix.tensor(X,i,j,by=NULL)
Arguments
X |
The tensor |
i |
The image indices of the linear mapping |
j |
The domain indices of the linear mapping |
by |
the operation is done in parallel for these dimensions |
Details
A tensor can be seen as a linear mapping of a tensor to a tensor. This function computes the corresponding matrix, mapping the entries of the domain tensor to the entries of the image tensor.
Value
if no by
is given a matrix. Otherwise a tensor of level
2+length(dim(X))[by]
giving matrices for each specification of the by dimensions.
Author(s)
K. Gerald van den Boogaart
See Also
to.tensor
, solve.tensor
,
inv.tensor
, svd.tensor
Examples
A <- reorder.tensor(to.tensor(1:30,c(a=2,b=3,c=5)),c("c","a","b"))
to.matrix.tensor(A,"a",c("b","c")) # matrix(1:30,nrow=2)
to.matrix.tensor(A,c("a","b"),c("c")) # matrix(1:30,nrow=6)
to.matrix.tensor(A,c("a","b"),by=c("c")) # structure(1:30,dim=c(6,1,5)))
to.matrix.tensor(A,c("a"),by=c("c")) # structure(1:30,dim=c(2,3,5)))
[Package tensorA version 0.36.2.1 Index]