| diag.tensor | R Documentation | 
The diagonal tensor is the tensor equivalent of the diagonal matrix.
diag.tensor(X,mark="'",dn=NULL,by=NULL)
| X | a tensor containing the diagonal entries. | 
| mark | a character to be concatenated to the names of the row dimensions to get the column dimension names | 
| dn | dimnames which are used twice | 
| by | The diagonal tensor is created for each level of the indices
in  | 
E_{i_1\ldots i_n j_1\ldots
      j_n}=\delta_{i_1j_1}\ldots\delta_{i_nj_n}
a tensor with dimension c(dim(X),mark(dim(X),mark))
K. Gerald van den Boogaart
to.tensor
A <- to.tensor(1:4,c(a=2,b=2))
diag.tensor(A)
diag.tensor(A,by="b")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.