Hi Mateusz,
First of all, to answer your questions 2 and 3, the page tutorials/MPS you reached had some incorrect information on it. I just updated that page to now have the correct information.
So the correct information about psi.A(j) is that it just provides read-only access to the MPS tensor at site j, without modifying that tensor in any way. If you do want to modify the tensor at site j you can call psi.Aref(j). Neither of these changes the MPS gauge. To move the MPS gauge center to some site i call psi.position(i);
Finally, about writing the tensor elements to a text file, there isn't a facility in ITensor right now to do this automatically. But you could write a short code yourself to do this. The main thing to know is that you will need a local copy of the MPS indices to access elements. To get these you can use the linkInd method.
So let's say you want to get the elements of the third MPS tensor psi.A(3). Here is some sample code for doing that:
auto ll = linkInd(psi,2);
auto rl = linkInd(psi,3);
auto s = findtype(psi.A(3),Site);
Print(psi.A(3).real(ll(4),s(2),rl(7)));
The code above will give you the 4,2,7 element of the tensor A(3). You can get the sizes of each of the indices ll, rl, and s by calling ll.m()
, rl.m()
etc. and then looping over all of the values of the tensor and printing them to a file.
Best regards,
Miles