Skip to content

Commit 79193c4

Browse files
committed
Remove optimal sequence finding functions in favour of TensorOperations
1 parent 3fa632c commit 79193c4

File tree

14 files changed

+44
-871
lines changed

14 files changed

+44
-871
lines changed

Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
3434

3535
[extensions]
3636
ITensorsHDF5Ext = "HDF5"
37+
ITensorsTensorOperationsExt = "TensorOperations"
3738
ITensorsVectorInterfaceExt = "VectorInterface"
3839
ITensorsZygoteRulesExt = "ZygoteRules"
3940

@@ -58,6 +59,7 @@ SimpleTraits = "0.9.4"
5859
SparseArrays = "<0.0.1, 1.10"
5960
StaticArrays = "0.12, 1.0"
6061
Strided = "1.1, 2"
62+
TensorOperations = "5.1.4"
6163
TimerOutputs = "0.5.5"
6264
TupleTools = "1.2"
6365
VectorInterface = "0.4, 0.5"
@@ -68,5 +70,6 @@ julia = "1.10"
6870
[extras]
6971
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
7072
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
73+
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
7174
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
7275
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module ITensorsTensorOperationsExt
2+
3+
using ITensors: ITensors, ITensor, dim, inds
4+
using NDTensors.AlgorithmSelection: @Algorithm_str
5+
using TensorOperations: TensorOperations, optimaltree
6+
7+
function ITensors.optimal_contraction_sequence(As::Union{Vector{<:ITensor},Tuple{Vararg{ITensor}}})
8+
network = collect.(inds.(As))
9+
inds_to_dims = Dict(i => Float64(dim(i)) for i in unique(reduce(vcat, network)))
10+
seq, _ = optimaltree(network, inds_to_dims)
11+
return seq
12+
end
13+
14+
end

src/ITensors.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ Documentation: https://itensor.github.io/ITensors.jl/stable/
5151
module ITensors
5252
include("usings.jl")
5353
include("utils.jl")
54-
include("lib/ContractionSequenceOptimization/src/ContractionSequenceOptimization.jl")
55-
# TODO: `using .ContractionSequenceOptimization: ContractionSequenceOptimization, ...`.
56-
using .ContractionSequenceOptimization
5754
include("lib/LazyApply/src/LazyApply.jl")
5855
# TODO: `using .LazyApply: LazyApply, ...`.
5956
using .LazyApply
@@ -105,6 +102,7 @@ include("indexset.jl")
105102
include("itensor.jl")
106103
include("qn/flux.jl")
107104
include("oneitensor.jl")
105+
include("tensor_operations/contraction_cost.jl")
108106
include("tensor_operations/tensor_algebra.jl")
109107
include("tensor_operations/matrix_algebra.jl")
110108
include("tensor_operations/permutations.jl")

src/imports.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ import Base.Broadcast:
8181
broadcastable,
8282
instantiate
8383

84-
import ITensors.ContractionSequenceOptimization:
85-
contraction_cost, optimal_contraction_sequence
86-
8784
import Adapt: adapt_structure, adapt_storage
8885

8986
import LinearAlgebra:

src/lib/ContractionSequenceOptimization/src/ContractionSequenceOptimization.jl

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/lib/ContractionSequenceOptimization/src/breadth_first_constructive.jl

Lines changed: 0 additions & 235 deletions
This file was deleted.

0 commit comments

Comments
 (0)