Skip to content

Add QuadraticFormNetwork - #195

Open
jack-dunham wants to merge 3 commits into
jd/itensor-network-operatorfrom
jd/quadraticform
Open

jack-dunham wants to merge 3 commits into
jd/itensor-network-operatorfrom
jd/quadraticform

Conversation

@jack-dunham

@jack-dunham jack-dunham commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Adds QuadraticFormNetwork, a lazy representation of ⟨ψ|O|ψ⟩ where O is an ITensorNetworkOperator. Each later can be obtained via ketnetwork, operatornetwork and branetwork. Belief propagation runs on it directly.

The constructor checks that the operator's inputs are site indices of ψ on the right vertices, and that no index names clash between layers.

NormNetwork and QuadraticFormNetwork now share an AbstractBilinearFormNetwork supertype, and both live in src/bilinearforms/.

@ITensorBot

ITensorBot commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Your PR no longer requires formatting changes. Thank you for your contribution!

@codecov

codecov Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.91304% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.08%. Comparing base (6af047a) to head (0f01577).

Files with missing lines Patch % Lines
src/bilinearforms/quadraticformnetwork.jl 97.43% 1 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                       @@
##           jd/itensor-network-operator     #195      +/-   ##
===============================================================
+ Coverage                        91.77%   92.08%   +0.31%     
===============================================================
  Files                               18       19       +1     
  Lines                              802      847      +45     
===============================================================
+ Hits                               736      780      +44     
- Misses                              66       67       +1     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/itensornetworkoperator.jl Resolved
return names(tn[src(edge)]) ∩ names(tn[dst(edge)])
return names(tn, src(edge)) ∩ names(tn, dst(edge))
end
function linknames(tn::AbstractGraph)

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've gone back and forth about this kind of definition... I feel like linknames(tn) is a bit underdefined, and maybe should output a Dictionary from edges to link names. Then maybe we could define flatten_linknames as a flattened version. Also, when it is being used, does it need to be instantiated, or is lazy fine? If so I'd even lean towards only defining linknames(tn) to output a Dictionary and then callsites can call Iterators.flatten(linknames(tn)).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think most of the time we just want to iterate over linknames, which even as a dictionary, wouldn't need flatten explicitly.

@jack-dunham jack-dunham changed the title Add ITensorNetworkOperator and QuadraticFormNetwork data structures Add QuadraticFormNetwork Oct 30, 2026
@jack-dunham
jack-dunham changed the base branch from main to jd/itensor-network-operator October 30, 2026 18:10
@jack-dunham
jack-dunham added this pull request to stack #208 October 30, 2026 18:11
jack-dunham and others added 3 commits October 30, 2026 14:26
The graph structure, `braname`, `kettensor`, `bratensor`, `branetwork` and the name-map
checks move from `NormNetwork` to the abstract type, defined from `ketnetwork` and
`branamemap`. `BraView` wraps any subtype.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pure move: `normnetworkview.jl` becomes `abstractbilinearformnetwork.jl` and `normnetwork.jl`
moves alongside it, with only the `include` paths updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The triple-layer network `⟨tn|op|tn⟩` of a ket layer and an `ITensorNetworkOperator`,
built on the bilinear-form interface with `operatornetwork` and `operatortensor`, and
contracted by belief propagation through its `factor_tensors` method.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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