Add fermionic support to belief-propagation simple update#155
Merged
Conversation
Keep belief-propagation messages as operators and normalize them by their trace rather than an entrywise sum, which stays sign correct on fermionic bonds where the entrywise sum can flip the odd-parity block. Gauge the simple-update tensors with the balanced square root and inverse square root of the Hermitian-projected bond messages. Depends on the operator-form Hermitian factorizations added in the ITensorBase mf/operator-sqrth branch.
The BP simple-update gauge absorbs an operator-valued square root of each incoming message into the state tensor. Contracting it with `*` returns an operator, so the updated state is written back as an operator and rejected by the state network. Take the underlying tensor of each gauge (`ITB.state`) before contracting, so the gauged state stays a plain tensor while the index arrows still carry the fermion sign. Requires the operator `dimnametype` fix from ITensor/ITensorBase.jl#225. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Store both directed messages of a bond uniformly as the bond (ket output) and an auxiliary leg (bra input), with conj(S)/S into the two endpoints, and build the initial identity messages on the source-side ket axis so their ket leg is dual to the destination bond. The gauge projects the message Hermitian and takes the balanced square-root / inverse-square-root in whichever bipartition is positive semidefinite, which recovers the odd-parity fermion sign in both directions. Migrate the message-update path to the ITensorBase 0.13 outputnames/inputnames API and bump to 0.9.10.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #155 +/- ##
==========================================
- Coverage 84.89% 84.43% -0.46%
==========================================
Files 15 15
Lines 662 681 +19
==========================================
+ Hits 562 575 +13
- Misses 100 106 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Replace the try/catch PSD-bipartition selection in `message_gauge` with a plain transposed gauge. The two directed bond messages are now built from the PSD singular-value message `conj(S)`. The reverse direction is its arrow flip via `dualize`, which toggles `isdual` and keeps the odd-parity block, rather than `conj`, which negates the odd block and breaks PSD. Free-fermion validation is exact to machine precision on trees with no fallback. `dualize` is a temporary element-wise hack that pulls in a temporary `GradedArrays` dependency. Both stand in for a proper backend-agnostic duality-flip primitive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The reverse directed message is S with its bond orientation reversed, which is the ribbon twist of S (-1 on the odd-parity sector). Both directed messages are then positive semidefinite in the transposed gauge, so the gauge needs no fallback. This replaces the element-wise dualize helper with a name-keyed twist and twist!. Also simplify the belief-propagation message unwrap to state.(messages), relying on state being idempotent.
mtfishman
force-pushed
the
mf/fermion-bp-sign
branch
from
July 24, 2026 17:36
03f6abd to
0f0ec76
Compare
…n twist Each directed simple-update message is now the doubled contraction of the gate factor with its conjugate, rather than being read off the singular-value spectrum as conj(S) and a ribbon-twisted S. The graded contraction of a factor with its conjugate carries the odd-parity fermion sign on its own, so the explicit ribbon twist (and the direct GradedArrays dependency it needed) is gone.
mtfishman
force-pushed
the
mf/fermion-bp-sign
branch
from
July 24, 2026 17:38
0f0ec76 to
8d169d4
Compare
Build the message gauge and its inverse explicitly from `eigh_full` as `v * √d * v'` and `v * √d⁻¹ * v'`, rather than calling `sqrth_invsqrth_safe`, so the mechanism handling the odd-parity bipartition is visible in place. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`src/` no longer references GradedArrays directly, so remove it from the package dependencies. It remains available transitively and in the test project, where it is still used. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the narration of the leg relabeling and the unclear claim about where the sign lands, keeping only the reason for the transposed bipartition. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Record in the comment that `v * √d * v'` is used because it works with fermions, and that the asymmetric `√d * v'` gauge has an issue still under investigation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The single-site normalization only needs the message square root, not its inverse, so `first(message_gauge(...))` built and discarded the inverse root. Factor the shared eigendecomposition into `message_eigen` and add `message_root`, which the single-site path now calls. `message_gauge` still returns the root together with its inverse for the two-site split.
Cover `FermionParity` sites alongside the bosonic ranges. The apply tests now carry the belief-propagation environment through the gate applications, as real usage does, instead of rebuilding it from `beliefpropagation` and re-wrapping the messages with a test helper. Belief-propagation convergence is covered by `test_beliefpropagation.jl`. This needs GradedArrays 0.14, whose graded square-root path is sign-correct for fermions where 0.13 throws.
mtfishman
marked this pull request as ready for review
July 24, 2026 21:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds fermionic support to the belief-propagation simple-update apply-gate (
apply_operators). The odd-parity sign on a fermionic bond needs care in the gauge. Each directed message is built as the doubled contraction of the gate factor with its conjugate, which carries the sign, and the gauge roots each message in the bipartition where it is positive semidefinite. The bosonic path is unchanged.The apply tests cover
FermionParitysites alongside the bosonic ranges, carrying the belief-propagation environment through the gate applications rather than rebuilding it from scratch. Convergence of the message passing stays covered by the belief-propagation tests. The test environment requires GradedArrays 0.14, whose graded square-root path is sign-correct for fermions where 0.13 throws.