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

Belief Propagation Version 3 #85

Merged
merged 27 commits into from
Apr 25, 2023

Conversation

JoeyT1994
Copy link
Contributor

This PR introduces a more generalized version of belief propagation where the message tensors are now ITensorNetworks whose structure can be specified by the user.
Message tensor updates therefore can utilize the approx_itensornetwork() function and thus there is a new degree of freedom one can utilise for belief propagation. Default behaviour (not specifying contraction arguments for update_mt()) is to have the message tensors take the form of an ITensorNetwork containing a single ITensor

Corresponding tests and examples have been updated to reflect these changes.

Within beliefpropagation.jl, the calculate_contraction function has been replaced with calculate_contraction_network and it is then up to the user to decide how to contract the resulting network to obtain, e.g., an expectation value.

I have also defined ITensorNetwork(t::ITensor) to default to ITensorNetwork(ITensor[t])

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2023

Codecov Report

Merging #85 (4866b6a) into main (480b2c7) will increase coverage by 0.18%.
The diff coverage is 87.87%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
+ Coverage   77.75%   77.94%   +0.18%     
==========================================
  Files          62       62              
  Lines        3273     3287      +14     
==========================================
+ Hits         2545     2562      +17     
+ Misses        728      725       -3     
Impacted Files Coverage Δ
src/abstractitensornetwork.jl 81.84% <66.66%> (-0.47%) ⬇️
src/beliefpropagation.jl 87.27% <90.00%> (-6.17%) ⬇️
src/apply.jl 91.66% <100.00%> (+0.08%) ⬆️
src/gauging.jl 100.00% <100.00%> (ø)
src/itensornetwork.jl 86.66% <100.00%> (+0.45%) ⬆️

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

src/beliefpropagation.jl Outdated Show resolved Hide resolved
src/beliefpropagation.jl Outdated Show resolved Hide resolved
src/beliefpropagation.jl Outdated Show resolved Hide resolved
src/beliefpropagation.jl Outdated Show resolved Hide resolved
src/beliefpropagation.jl Outdated Show resolved Hide resolved
@mtfishman
Copy link
Member

@JoeyT1994 besides the function renaming I raised in the comments above, over all it looks good! Nice to see it involves pretty minimal changes. Is there anything in particular you think I should look at?

@JoeyT1994
Copy link
Contributor Author

No I think it all seems straightforward and there is nothing else in particular for you to look at. Just let me know what you want to do with the output type of get_environment.

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

Okay I think I have made the belief propagation interface much simpler following your suggestions. Initialisation now always gives a rank 1 MPS with the on-site tensor constructor specificable by the user.
The datagraph passed to message_tensor() must always have ITensorNetworks directly as the vertex data and thus should be the output of the partition() function.
There is also the option of message_tensors(tn::ITensorNetwork; partition_args) for handling the partitioning within belief_propagation.jl

@mtfishman
Copy link
Member

Looks great, thanks!

@mtfishman mtfishman merged commit ee90168 into ITensor:main Apr 25, 2023
@JoeyT1994 JoeyT1994 deleted the ITensorNetworkBeliefPropagation branch April 26, 2023 16:52
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