ITensor / ITensors.jl

A Julia library for efficient tensor computations and tensor network calculations
https://itensor.org
Apache License 2.0
522 stars 122 forks source link

Add `firstsiteinds(::MPS)` #496

Open mtfishman opened 4 years ago

mtfishman commented 4 years ago

To help with generic code for MPS/MPO (i.e. code that works for both), it would help to define firstsiteinds(M::MPS) = siteinds(M).

Also, it may be good to think about the assumption that is often used in MPS functions that MPS have only one site index, since sometimes it can be more natural to have more than one (for example a Choi matrix representing a pure quantum process, or the boundary MPS of a double layer PEPS). For that case, it may be useful to define functions like allsiteinds(::MPS/MPO), that searches for all site-like indices (indices that are not shared with any neighbors in the MPS/MPO) and return them as a vector of IndexSets.

mtfishman commented 3 years ago

We should also reconsider the behavior of siteinds(::MPO). Right now, it acts like the proposed function allsiteinds(::MPO), in that it returns a vector of IndexSets of all site indices on each site. However, it could be nice if it returned the dagger of the unprimed indices of the MPO, i.e. the indices you would use to create a "similar" MPO. This would help with generic MPS/MPO code, so that siteinds(::MPS/MPO) would generally return the same set of indices, from which new MPS/MPO could be created (with the same prime level and arrow directions).