Closed JoeyT1994 closed 1 month ago
This sounds reasonable. Handling the corner case of having no link indices vs. trivial link indices is definitely tricky and part of this package that I found most difficult to design, we may have to step back and assess it more systematically at some point.
This PR allows one to pass the kwarg
link_space = nothing
into theITensorNetwork(f::Function, s::IndsNetwork; ...)
constructor so that it doesn't add any link indices when constructing theITensorNetwork
. The change is made at the level ofinsert_linkinds(s::IndsNetwork; link_space = trivial_space(s)
. The default of link indices of dimension 1 is unchanged.One can now do
ITensorNetwork(Op("I), s; link_space = nothing)
to build the identity operator without any link indices. The default for theBiLinearForm(psi, phi; ...)
constructor is done based on whetherpsi
does or doesn't have site indices.@mtfishman I'm adding this so that when one builds the
formnetwork
<psi|I|psi>
and does BP the message tensors don't end up with additional trivial indices which can lead to complications when you want to square root them and gauge the local state etc.Let me know if you can think of a better way to support this functionality or if you are okay with as is.