Skip to content

Commit 436950b

Browse files
committed
Sequence optimization
1 parent 9d6c1bc commit 436950b

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

Project.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorNetworks"
22
uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7"
33
authors = ["Matthew Fishman <[email protected]>, Joseph Tindall <[email protected]> and contributors"]
4-
version = "0.11.27"
4+
version = "0.11.28"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
@@ -12,34 +12,38 @@ DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
1212
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
1313
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1414
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
15+
EinExprs = "b1794770-133b-4de1-afb4-526377e9f4c5"
1516
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1617
ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2"
1718
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
1819
IsApprox = "28f27b66-4bd8-47e7-9110-e2746eb8bed7"
1920
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
21+
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
2022
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
2123
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2224
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
2325
NDTensors = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
2426
NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"
27+
OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715"
2528
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
2629
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
2730
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
31+
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
2832
SerializedElementArrays = "d3ce8812-9567-47e9-a7b5-65a6d70a3065"
2933
SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
3034
SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2"
3135
SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66"
36+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
3237
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
3338
StructWalk = "31cdf514-beb7-4750-89db-dda9d2eb8d3d"
3439
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
40+
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
3541
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
3642
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"
3743

3844
[weakdeps]
3945
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
40-
EinExprs = "b1794770-133b-4de1-afb4-526377e9f4c5"
4146
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889"
42-
OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715"
4347
Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0"
4448

4549
[extensions]
@@ -66,20 +70,24 @@ ITensorMPS = "0.3"
6670
ITensors = "0.7, 0.8"
6771
IsApprox = "0.1, 1, 2"
6872
IterTools = "1.4.0"
73+
JuliaFormatter = "1.0.62"
6974
KrylovKit = "0.6, 0.7, 0.8"
7075
MacroTools = "0.5"
7176
NDTensors = "0.3, 0.4"
7277
NamedGraphs = "0.6.0"
7378
OMEinsumContractionOrders = "0.8.3, 0.9"
7479
Observers = "0.2.4"
7580
PackageExtensionCompat = "1"
81+
Revise = "3.7.2"
7682
SerializedElementArrays = "0.1"
7783
SimpleTraits = "0.9"
7884
SparseArrayKit = "0.3, 0.4"
7985
SplitApplyCombine = "1.2"
86+
StableRNGs = "1.0.2"
8087
StaticArrays = "1.5.12"
8188
StructWalk = "0.2"
8289
Suppressor = "0.2"
90+
TensorOperations = "5.1.4"
8391
TimerOutputs = "0.5.22"
8492
TupleTools = "1.4"
8593
julia = "1.10"

src/ITensorNetworks.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module ITensorNetworks
22
include("lib/BaseExtensions/src/BaseExtensions.jl")
33
include("lib/ITensorsExtensions/src/ITensorsExtensions.jl")
4+
include("lib/TensorOperationsExt/TensorOperationsExt.jl")
45
include("visualize.jl")
56
include("graphs.jl")
67
include("abstractindsnetwork.jl")

src/contraction_sequences.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Graphs: vertices
22
using ITensors: ITensor, contract
3-
using ITensors.ContractionSequenceOptimization: deepmap, optimal_contraction_sequence
3+
using ITensors.ContractionSequenceOptimization: deepmap
44
using ITensors.NDTensors: Algorithm, @Algorithm_str
55
using NamedGraphs.Keys: Key
66
using NamedGraphs.OrdinalIndexing: th
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module TensorOperationsExt
2+
using ITensors: ITensors, ITensor, dim, inds
3+
using TensorOperations: optimaltree
4+
5+
function ITensors.optimal_contraction_sequence(tensors::Vector{<:ITensor})
6+
network = collect.(inds.(tensors))
7+
inds_to_dims = Dict(i => dim(i) for i in unique(reduce(vcat, network)))
8+
seq, _ = optimaltree(network, inds_to_dims)
9+
return seq
10+
end
11+
12+
end

0 commit comments

Comments
 (0)