Hi Matt,
Thank you for your answers. The documentation was helpful to resolve my issue. Sorry for asking so many basic dumb questions. I am not sure what exactly is going wrong when I try to access the 2nd order components of the 3 dimensional tensors using "setelt". Here is a code that generates an ensemble of 30 random density matrices of dimension 5*5.
using ITensors
using QuantumInformation
using LinearAlgebra
function random_ensemble(size,en_size)
i = Index(size,"i")
j = Index(size,"j")
en = Index(en_size,"en")
rho = ITensor(i,j,en);
for en_index=1:en_size
h = HilbertSchmidtStates{1}(size)
ρ = rand(h);
for x=1:size
for y=1:size
rho[x,y,en_index]= ρ[x,y];
end
end
end
return rho
end
rho_new=random_ensemble(5,30)
However, when I call "rho_new*setelt(en=>5)" to obtain the 5th element of the ensemble, I instead get an order 4 tensor with two "en" index.