-
Notifications
You must be signed in to change notification settings - Fork 23
Contraction sequence finding #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mtfishman
merged 22 commits into
ITensor:main
from
JoeyT1994:ContractionSequenceFinding
Mar 21, 2025
Merged
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c845947
Blah
JoeyT1994 90c7251
Merge remote-tracking branch 'origin/main'
JoeyT1994 86f3087
Merge remote-tracking branch 'upstream/main'
JoeyT1994 6ff0cd5
Bug fix in current ortho. Change test
JoeyT1994 34e8e5e
Merge remote-tracking branch 'upstream/main'
JoeyT1994 d096722
Fix bug
JoeyT1994 70a3f7e
Merge remote-tracking branch 'upstream/main'
JoeyT1994 9d64fe8
Merge remote-tracking branch 'upstream/main'
JoeyT1994 9d6c1bc
File removed
JoeyT1994 436950b
Sequence optimization
JoeyT1994 5da529a
Fix Project toml
JoeyT1994 8f13426
Simplify
JoeyT1994 76eb1b3
Version Bump. Proper package extension for TensorOperations
JoeyT1994 e66f3a4
Move TensorOperations to weak dep
JoeyT1994 0bf8251
Simply function and namescape
JoeyT1994 0519e95
Import TensorOperations into test namespace
JoeyT1994 ddbdfe5
Error message
JoeyT1994 9ca88b4
Better error message
JoeyT1994 f858169
Add TensorOps to test Project.toml. Alphabetize
JoeyT1994 9543801
Type specification
JoeyT1994 632aeb0
ITensorList
JoeyT1994 146e661
Formatting
JoeyT1994 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| name = "ITensorNetworks" | ||
| uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7" | ||
| authors = ["Matthew Fishman <[email protected]>, Joseph Tindall <[email protected]> and contributors"] | ||
| version = "0.11.27" | ||
| version = "0.12.0" | ||
|
|
||
| [deps] | ||
| AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" | ||
|
|
@@ -32,6 +32,7 @@ SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66" | |
| StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
| StructWalk = "31cdf514-beb7-4750-89db-dda9d2eb8d3d" | ||
| Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" | ||
| TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" | ||
| TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" | ||
| TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6" | ||
|
|
||
|
|
@@ -48,6 +49,7 @@ ITensorNetworksEinExprsExt = "EinExprs" | |
| ITensorNetworksGraphsFlowsExt = "GraphsFlows" | ||
| ITensorNetworksOMEinsumContractionOrdersExt = "OMEinsumContractionOrders" | ||
| ITensorNetworksObserversExt = "Observers" | ||
| ITensorNetworksTensorOperationsExt = "TensorOperations" | ||
|
|
||
| [compat] | ||
| AbstractTrees = "0.4.4" | ||
|
|
@@ -80,6 +82,7 @@ SplitApplyCombine = "1.2" | |
| StaticArrays = "1.5.12" | ||
| StructWalk = "0.2" | ||
| Suppressor = "0.2" | ||
| TensorOperations = "5.1.4" | ||
| TimerOutputs = "0.5.22" | ||
| TupleTools = "1.4" | ||
| julia = "1.10" | ||
|
|
@@ -90,6 +93,7 @@ EinExprs = "b1794770-133b-4de1-afb4-526377e9f4c5" | |
| GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889" | ||
| OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715" | ||
| Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" | ||
| TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" | ||
| Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
|
||
| [targets] | ||
|
|
||
19 changes: 19 additions & 0 deletions
19
ext/ITensorNetworksTensorOperationsExt/ITensorNetworksTensorOperationsExt.jl
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| module ITensorNetworksTensorOperationsExt | ||
|
|
||
| using ITensors: ITensors, ITensor, dim, inds | ||
| using ITensorNetworks: ITensorNetworks | ||
| using TensorOperations: optimaltree | ||
| using NDTensors.AlgorithmSelection: @Algorithm_str | ||
|
|
||
| function ITensorNetworks.contraction_sequence(::Algorithm"optimal", tn::Vector{ITensor}) | ||
| return optimal_contraction_sequence(tn) | ||
| end | ||
|
|
||
| function optimal_contraction_sequence(tensors::Vector{<:ITensor}) | ||
| network = collect.(inds.(tensors)) | ||
| inds_to_dims = Dict(i => dim(i) for i in unique(reduce(vcat, network))) | ||
| seq, _ = optimaltree(network, inds_to_dims) | ||
| return seq | ||
JoeyT1994 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| end | ||
|
|
||
| end | ||
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.