Just some quick questions about the apply method (sorry if the answers are stated in the docs or forum somewhere, but I couldn’t find them).
On the ITensor website in Tutorials > MPS Time Evolution, the line psi = apply(gates, psi; cutoff) passes gates, which is of type Array{ITensor, 1}, to the first argument of apply. In the docs I can only find info about the behaviour of apply when the first argument is an MPO.
Does the apply method in the MPS Time Evolution code:
(A) Convert each of the operations in gates into a separate MPO and apply them one by one to the MPS? Or
(B) Convert gates into a single MPO and then contract with the MPS?
In Code Examples > MPS and MPO Examples > Applying a Two-site Operator to an MPS, the code explicitly moves the orthogonality centre of the MPS appropriately, resets the prime level of the indices to 0, and groups the singular values to the right in the last step.
(Assuming the answer to Q1 is A) I know that apply deals with the index primes, but in the MPS Time Evolution code, does apply also automatically move the orthogonality centre appropriately (as in the Applying a Two-site Operator to an MPS example) each time an operation is applied? And are the singular values grouped to the right-most site of the last operation applied to the MPS (which, if my understanding is correct, means the orthogonality centre is also on the right-most site of the final operation)?
It should first swap sites of the gates if they are not contiguous, then contract the MPS/MPO tensors to match the gate, apply the gate, and decompose back (and potentially move the sites back). This is the same as the two site operator example you mention
Yes, apply should be taking care of the orthogonality center movements. The orthogonality center is moved to the first site in the operator before its applied. As you can see in the code snippet below, this can probably be optimized a bit more (PRs welcome!)
The resulting MPS should have the orthogonality center on the right-most site of the gate at the end, looking at source