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

Refactor expect (single site) #162

Merged
merged 15 commits into from
May 3, 2024

Conversation

JoeyT1994
Copy link
Contributor

This PR refactors the expect() interface.

expect(psi::AbstractITensorNetwork, op::Op) now passes to the environment(f::AbstractFormNetwork, ...) function introduced in PR #145 and thus allows the expect() function to have a choice of algorithmic backend, with "bp" and "exact" currently supported.

Testing is added with test_expect.jl with some tests are removed from test_beliefpropagation.jl to avoid added.
Currently single-site expectation values are supported (so some tests which were computing two-site ones in test_tebd.jl have been temporarily disabled) but multi_site will be added in the near future.

src/expect.jl Outdated Show resolved Hide resolved
test/test_expect.jl Outdated Show resolved Hide resolved
src/expect.jl Outdated Show resolved Hide resolved
@JoeyT1994
Copy link
Contributor Author

JoeyT1994 commented Apr 29, 2024

@mtfishman I refactored environment(alg::Algorithm, ...) in src/environment.jl so that the central BP version takes a PartitionedGraph as input and then environment(alg::Algorithm"bp", psi::AbstractITensorNetwork, ...) will wrap to a PartitionedGraph and send to the central version.

As AbstractFormNetwork <: AbstractITensorNetwork this means that those functions will automatically work on an AbstractFormNetwork and so I removed any re-definition of environment in the src/formnetworks

Let me know what you think

@mtfishman
Copy link
Member

Looks good, thanks!

@mtfishman mtfishman merged commit adce5ac into ITensor:main May 3, 2024
5 of 6 checks passed
@JoeyT1994 JoeyT1994 deleted the refactor_expect_simplified 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