Hello,
I found a counterintuitive problem in svd when I permuted the indices of the tensor. The code is as follows:
using ITensors
i = Index(3)
j = Index(4)
k = Index(5)
A = randomITensor(i,j,k)
B = permute(A, j, i, k)
UA, SA, VA = svd(A, i, j)
UB, SB, VB = svd(B, i, j)
@assert array(permute(UA, i, j, commonind(UA, SA))) โ array(permute(UB, i, j, commonind(UB, SB)))
Here I permuted the first two indices of tensor A to get the tensor B, then performed the svd with the first two indices as the left indices. Naively, I would expect that UA and UB would have the same matrix elements after I permute the indices of these two tensors again to have the same order. But the result is very counterintuitive, and they have different matrix elements. Do you know why? I checked that SA and SB have the same matrix elements, i.e., array(SA) โ array(SB)
is true.