Fancy indexing in ITensor

Hi folks,

As I elaborated here, I think I just missed it in the docs of ITensor, but I do not see an easy way to do “fancy” indexing. Lets us consider the following example

i = Index(10,"i")
j = Index(20,"j")
k = Index(30,"k")
A = randomITensor(i,j,k)
U,Σ,V = svd(A,(i,j));
u = commonind(U,Σ)
# Now I would like to select all rows where Σ is larger than 15
cn = (Σ.store .> 15)
dim_cn = sum(cn)
c = Index(dim_cn,"c")
selector = zeros(dim_cn,dim(u))
selector[:,cn].= I(dim_cn)
selector = ITensor(selector,c,u)
U_new = selector * U

You see what is my goal: I would like to select specific rows of U. With standard Julia syntax I could just use

U_new = U[:,Σ.> 15]

Even more so, sometimes it would be interesting to select specific rows, such as

U_new = U[:,1]

In order to loop through U. This is, of course, also possible with the above method, but still a little bit clumsy.

Thanks a lot.

Best,

v.