Skip to content

Remove approximate-contract (density_matrix / ttn_svd) algorithms#329

Merged
mtfishman merged 1 commit intomainfrom
mf/remove-approx-contract
Apr 24, 2026
Merged

Remove approximate-contract (density_matrix / ttn_svd) algorithms#329
mtfishman merged 1 commit intomainfrom
mf/remove-approx-contract

Conversation

@mtfishman
Copy link
Copy Markdown
Member

@mtfishman mtfishman commented Apr 23, 2026

Summary

Delete the entire src/contract_approx/ module (8 files, ~1200 lines) and the dead ITensorNetworksGraphsFlowsExt extension that only served it.

Breaking:

  • contract(tn; alg = "density_matrix") and contract(tn; alg = "ttn_svd") are removed.
  • The contract_approx function and all of its supporting machinery (path_graph_structure, binary_tree_structure, _partition, _mincut_partitions, _contract_deltas, _rem_leaf_vertices!, …) are gone.
  • GraphsFlows is no longer a weak-dep / extension trigger of ITensorNetworks. It remains a direct test-time dep for the graph mincut test in test/test_itensornetwork.jl.

What stays:

  • contract(tn; alg = "exact") and the rest of the contraction pipeline (TensorOperations / OMEinsumContractionOrders extensions) are unaffected.

Incidental import cleanups

A few imports were previously available inside ITensorNetworks as a side effect of using clauses in src/contract_approx/*.jl. They are now imported directly by the files that actually use them:

  • Graphs: rem_vertex!src/treetensornetworks/opsum_to_ttn/opsum_to_ttn.jl
  • ITensors: indssrc/abstractitensornetwork.jl
  • ITensors: noncommonindssrc/apply.jl
  • NamedGraphs.GraphsExtensions: disjoint_unionsrc/formnetworks/linearformnetwork.jl, src/formnetworks/bilinearformnetwork.jl

Version

Bumps to 0.17.0 (pre-1.0 minor bump = breaking) and updates pinned ITensorNetworks compat in test/, docs/, and examples/ Project.toml.

@mtfishman mtfishman force-pushed the mf/remove-approx-contract branch from 6dec7e1 to e16b951 Compare April 23, 2026 21:14
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.51%. Comparing base (6912226) to head (b8cfece).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #329      +/-   ##
==========================================
+ Coverage   71.23%   72.51%   +1.27%     
==========================================
  Files          80       71       -9     
  Lines        4001     3496     -505     
==========================================
- Hits         2850     2535     -315     
+ Misses       1151      961     -190     
Flag Coverage Δ
docs 42.25% <ø> (+5.44%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@mtfishman mtfishman force-pushed the mf/remove-approx-contract branch from e16b951 to 1920b44 Compare April 23, 2026 23:03
Delete the entire src/contract_approx/ module (8 files, ~1200 lines),
its two test files (test/test_binary_tree_partition.jl,
test/test_contract_deltas.jl), and the dead ITensorNetworksGraphsFlowsExt
extension that only served it. Drop the GraphsFlows weakdep + extension
entry from the root Project.toml; GraphsFlows stays as a direct test-time
dep for the graph mincut test in test/test_itensornetwork.jl.

Also drop the `contract(tn; alg = "density_matrix" | "ttn_svd")` dispatch
from src/contract.jl, which was a thin forwarder to contract_approx. The
remaining `alg = "exact"` dispatch is unaffected.

A few imports that were previously made available to other parts of the
package as a side effect of contract_approx/*.jl's `using` clauses now
need to be imported explicitly by the files that actually use them:
- Graphs: rem_vertex! in src/treetensornetworks/opsum_to_ttn/opsum_to_ttn.jl
- ITensors: inds in src/abstractitensornetwork.jl
- ITensors: noncommoninds in src/apply.jl
- NamedGraphs.GraphsExtensions: disjoint_union in src/formnetworks/{linear,bilinear}formnetwork.jl

Bump to 0.17.0 (breaking, pre-1.0 minor bump) and update pinned
ITensorNetworks compat in test/, docs/, and examples/ Project.toml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman force-pushed the mf/remove-approx-contract branch from 1920b44 to b8cfece Compare April 23, 2026 23:04
@mtfishman mtfishman merged commit 04b80c5 into main Apr 24, 2026
17 checks passed
@mtfishman mtfishman deleted the mf/remove-approx-contract branch April 24, 2026 01:57
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.

1 participant