Hi Miles,
I am using the latest Julia version ITensors.
1.I defined an Index with QN. When I set "dir = In", the Index is not ordered, e.g. qn(s(2)) = QN("N",4,5). When I set "dir = Neither", qn(s(j)) always gives QN("N",0,5). Is this a bug?
s = Index([QN(("N",i,5)) => 1 for i = 0:4];dir = ITensors.Arrow(0))
qn(s(2))
BTW, the direction name "Out", "In" conflict with Out and In in Jupyter Notebook.
2.I wanted to svd an ITensor with QN, but it says "In setindex!
, the element you are trying to set is in a block that does not have the same flux as the other blocks of the ITensor. You may be trying to create an ITensor that does not have a well defined quantum number flux."
dim0 = 4
s = Index([QN(("N",i,dim0))=>1 for i = 0:(dim0-1)];dir = ITensors.Arrow(1))
#s = Index(dim0)
l = addtags(s,"left")
r = addtags(s,"right")
u = addtags(s,"up")
d = addtags(s,"down")
A = emptyITensor(l,r,u,d)
for sl = 1:dim0, sd = 1:dim0, sr = 1:dim0, su = 1:dim0
#if sl+sd == sr+su || abs(sl+sd-sr-su) == dim0
if val(qn(l(sl))+qn(d(sd))-qn(r(sr))-qn(u(su)),"N") == 0
A[l(sl),r(sr),u(su),d(sd)] = 1
end
end
svd(A, (l,d))
Am I doing wrong?
Thanks.
Jin