Skip to content

Revised Belief Propagation #26

Open
jack-dunham wants to merge 68 commits intoITensor:mainfrom
jack-dunham:bp
Open

Revised Belief Propagation #26
jack-dunham wants to merge 68 commits intoITensor:mainfrom
jack-dunham:bp

Conversation

@jack-dunham
Copy link
Copy Markdown
Contributor

@jack-dunham jack-dunham commented Nov 25, 2025

This PR express belief propagation in terms of the new interface based on AlgorithmsInterface.jl and the included AlgorithmsInterfaceExtensions.jl library.

JoeyT1994 and others added 29 commits January 6, 2026 09:55
Introduce `BeliefPropagationProblem` wrapper to hold the cache and the
error `diff` field.

Also simplifies some kwargs wrangling.
Also includes some fixes to the way `TensorNetwork` types are
constructed based on index structure.
…instead of trying to operate on existing graphs

The reason for this is:
- One only cares about the edges of the input graph
- A simple graph cannot be used as it "forgets" its edge names resulting
in recursion
- As shown with `TensorNetwork`, removing edges may not always be
defined.
This was caused by the change to the `cache` being backed by a directed
graph.
Comment thread src/beliefpropagation/abstractbeliefpropagationcache.jl Outdated
Comment on lines +155 to +156
array = ones(Tuple(inds(src) ∩ inds(dst)))
return convert(T, array)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may be slightly better as a code pattern for this:

Suggested change
array = ones(Tuple(inds(src) inds(dst)))
return convert(T, array)
return fill!(similar(T, Tuple(inds(src) inds(dst))), true)

There's a subtlety here when dealing with QN conserving and fermionic tensors, but I think this is a reasonable start and we can discuss that later.

An idea I've brought with with Joey is to use a randomized SVD or QR of the factor to get a better guess for the message. Again, not something for this PR but I wanted to bring it up as something to keep in mind.

Comment thread src/beliefpropagation/beliefpropagationproblem.jl Outdated
Comment thread src/LazyNamedDimsArrays/symbolicnameddimsarray.jl Outdated
Comment thread src/beliefpropagation/abstractbeliefpropagationcache.jl Outdated
Comment thread src/beliefpropagation/abstractbeliefpropagationcache.jl Outdated
Comment thread src/AlgorithmsInterfaceExtensions/AlgorithmsInterfaceExtensions.jl
@mtfishman
Copy link
Copy Markdown
Member

@jack-dunham can you resolve comments that you've addressed so it is easier to track what remains? Also can you rebase on main and format to get tests running cleanly?

An `AbstractTensorNetwork` has edge type `Nothing`, which can be
obtained from the `AbstractDataGraph` method.
@mtfishman mtfishman dismissed JoeyT1994’s stale review April 28, 2026 14:52

Joey's requests mostly complete as far as I know.

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