Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for building operators without a link space #171

Merged

Conversation

JoeyT1994
Copy link
Contributor

@JoeyT1994 JoeyT1994 commented May 8, 2024

This PR allows one to pass the kwarg link_space = nothing into the ITensorNetwork(f::Function, s::IndsNetwork; ...) constructor so that it doesn't add any link indices when constructing the ITensorNetwork. The change is made at the level of insert_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 the BiLinearForm(psi, phi; ...) constructor is done based on whether psi 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.

@mtfishman
Copy link
Member

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.

@mtfishman mtfishman merged commit 2ca5129 into ITensor:main May 14, 2024
5 of 6 checks passed
@JoeyT1994 JoeyT1994 deleted the support_nolinkinds_ITensorNetwork_constructor branch June 16, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants