The diagonal tensor is the tensor equivalent of the diagonal matrix.

1 | ```
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...i_n j_1...j_n}=δ_{i_1j_1}...δ_{i_n j_n}
*

a tensor with dimension `c(dim(X),mark(dim(X),mark))`

K. Gerald van den Boogaart

`to.tensor`

1 2 3 | ```
A <- to.tensor(1:4,c(a=2,b=2))
diag.tensor(A)
diag.tensor(A,by="b")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.