trace.tensor {tensorA} | R Documentation |
Collapse a tensor
Description
Collapses the tensor over dimensions i and j. This is like a trace for matrices or like an inner product of the dimensions i and j.
Usage
trace.tensor(X,i,j)
Arguments
X |
the tensor |
i |
a numeric or character vector of dimensions of |
j |
a numeric or character vector of dimensions of |
Details
Let be
the tensor. Then the result is given by
With the Einstein summing convention we would write:
Value
A tensor like X with the i and j dimensions removed.
Author(s)
K. Gerald van den Boogaart
See Also
Examples
A <- to.tensor(1:20,c(i=2,j=2,k=5))
A
trace.tensor(A,"i","j")
[Package tensorA version 0.36.2.1 Index]