Hello all! I’m new to ITensor and Tensor Networks so I’d greatly appreciate any help.
My problem is this: I currently have a predefined ITensor, A (2x2x2) which has been extracted from an MPS (psi) at site 3:
A = psi[3]
I would like to embed this tensor into a 4th order (2x2x2x2) zero tensor, T:
i = Index(2, "i")
j = Index(2, "j")
k = Index(2, "k")
l = Index(2, "l")
T = ITensor(i,j,k,l)
Once I embed A into T, the resulting tensor should be a 4th order tensor of dimension (2x2x2x2) (call it G). G should have the structure G[:,:,:,1] = A, and G[:,:,:,2] = a 3rd order (2x2x2) zero tensor. This means that a slice of G contains A, and the other slice contains the 3rd order zero tensor.
I’ve tried:
T[l => 1] = A
where I imagine that A is being embedded in the 1st slice of the last dimension of T (Where A is actually embedded is arbitrary). However, I get the following error:
MethodError: no method matching setindex!(::ITensor, ::ITensor, ::Pair{Index{Int64}, Int64})
My question is: How can I embed a 3rd order tensor A (2x2x2) into a 4th order zero tensor T (2x2x2x2) to achieve an output of a 4th order tensor (2x2x2x2) with the structure specified by G.
I hope this is clearly explained. Please let me know if you require more context (or a better explanation).
Thank you all!