# tomatrixtensor: The matrix corresponding to a tensor seen as a linear mapping... In tensorA: Advanced Tensor Arithmetic with Named Indices

## 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

 `1` ```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

`to.tensor`, `solve.tensor`, `inv.tensor`, `svd.tensor`
 ```1 2 3 4 5 6 7 8``` ```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))) ```