Add OMEinsumContractionOrders extension for contraction-order optimization#209
Merged
Conversation
…ation Adds an OMEinsumContractionOrders extension so any of its optimizers (`GreedyMethod`, `TreeSA`, `KaHyParBipartite`, `SABipartite`, `ExactTreewidth`, ...) can be passed directly as the algorithm to `optimize_evaluation_order`/`optimize_contraction_order`. The extension dispatches on the abstract `CodeOptimizer`, so it forwards whichever optimizers the resolved OMEinsumContractionOrders version provides (including `ExhaustiveSearch` once released) with no per-optimizer wrapping. It builds an `EinCode` from the flattened product, calls `optimize_code`, and translates the returned `NestedEinsum` back into a nested contraction expression.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #209 +/- ##
==========================================
+ Coverage 74.35% 74.58% +0.23%
==========================================
Files 29 30 +1
Lines 1505 1519 +14
==========================================
+ Hits 1119 1133 +14
Misses 386 386
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:
|
mtfishman
added a commit
to ITensor/ITensorNetworksNext.jl
that referenced
this pull request
Jul 2, 2026
## Summary Enables OMEinsumContractionOrders optimizers (`TreeSA`, `GreedyMethod`, `KaHyParBipartite`, ...) to be used as the contraction-order algorithm in `contract_network`. A package extension adds a `contraction_order` method for OMEinsumContractionOrders' `CodeOptimizer`, reusing the same flattened-product optimization path as the built-in `Greedy`/`Optimal`. Builds on the extension added in ITensor/ITensorBase.jl#209.
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 an OMEinsumContractionOrders extension so any of its optimizers (
GreedyMethod,TreeSA,KaHyParBipartite,SABipartite,ExactTreewidth, ...) can be passed directly as the algorithm tooptimize_evaluation_order/optimize_contraction_order. The extension dispatches on the abstractCodeOptimizer, so it forwards whichever optimizers the resolved OMEinsumContractionOrders version provides (includingExhaustiveSearchonce released) with no per-optimizer wrapping. It builds anEinCodefrom the flattened product, callsoptimize_code, and translates the returnedNestedEinsumback into a nested contraction expression.