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

Partitioned ITensorNetwork #126

Merged
merged 14 commits into from
Jan 26, 2024
Merged

Conversation

JoeyT1994
Copy link
Contributor

This PR utilizes the new PartitionedGraph structure from NamedGraphs.jl (see ITensor/NamedGraphs.jl#44) to re-write the belief propagation code.

Specifcally, we can now define a PartitionedITensorNetwork simply via

pitn = PartitionedGraph(itn, args....) where args are just some arguments on how to partition the network.

The resulting data structure contains itn and partitioning information. This simplifies the nested data graph implementation we were using previously for a partitioned ITensorNetwork.

The belief propagation code, examples and tests are now all re-written to reflect this and the code should be simpler. Message tensors are now just taken to be a map between the edges of partitioned_graph(pitn) and Vector{ITensor}. Partitioning information is contained entirely in pitn.

Lots of the code in src/partition.jlhas been deleted as it is redundant now. Code has only been kept when it is relevant to approx_itensornetwork.jl which has not been re-written with the new formalism yet. This has all been moved to the folder src/approx_itensornetwork

@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (5ec5228) 72.55% compared to head (48c6d8e) 72.68%.
Report is 1 commits behind head on main.

Files Patch % Lines
src/approx_itensornetwork/partition.jl 78.78% 7 Missing ⚠️
src/beliefpropagation/beliefpropagation.jl 94.11% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #126      +/-   ##
==========================================
+ Coverage   72.55%   72.68%   +0.12%     
==========================================
  Files          71       68       -3     
  Lines        4055     3935     -120     
==========================================
- Hits         2942     2860      -82     
+ Misses       1113     1075      -38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/ITensorNetworks.jl Outdated Show resolved Hide resolved
examples/boundary.jl Outdated Show resolved Hide resolved
test/test_indsnetwork.jl Outdated Show resolved Hide resolved
src/exports.jl Outdated Show resolved Hide resolved
examples/boundary.jl Outdated Show resolved Hide resolved
examples/distances.jl Outdated Show resolved Hide resolved
src/apply.jl Outdated Show resolved Hide resolved
src/apply.jl Outdated Show resolved Hide resolved
src/apply.jl Outdated Show resolved Hide resolved
@JoeyT1994
Copy link
Contributor Author

Okay I have made changes which avoid the if statements that were in the belief_propagation code. Now the user can specify things like the cache for belief propagation, how to construct the message tensors and how to contract them together.

src/gauging.jl Outdated Show resolved Hide resolved
@JoeyT1994
Copy link
Contributor Author

Okay I re-wrote it based on function callback like we said. Currently the contract functions have been put in contract.jl but there is clearly some overlap there with existing contract functions. Up to you whether we re-write that a bit now or we leave as is until a future PR

@mtfishman
Copy link
Member

Let's leave that for a future PR.

This is definitely a big improvement to the BP code, and will make it a lot easier to implement more ambitious plans, like using BP in other functions like inner, expect, alternating_update, etc.

@mtfishman mtfishman merged commit a6250ac into ITensor:main Jan 26, 2024
8 of 11 checks passed
@JoeyT1994 JoeyT1994 deleted the PartitionedITensorNetwork 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.

3 participants