I would like to define n-th order tensor X in Julia.
When n is small, we can define i[1]×i[2]×…×[n] tensor as
X = rand(i[1],i[2],i[3])
or
X = Array{Float64, 3}(undef, i[1], i[2], i[3])
These examples are in case of n=3. But when n is large and list i is given, how can I define high order tensor??
EDIT
I found heuristics answer.
using TensorToolbox
i = [3,4,2,5,4,1,3]
X = diagt(i)
Is this best practice?