Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ Zeros = "bd1ec220-6eb4-527a-9b49-e79c3db6233b"

[weakdeps]
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"

[extensions]
ITensorsHDF5Ext = "HDF5"
ITensorsTensorOperationsExt = "TensorOperations"
ITensorsVectorInterfaceExt = "VectorInterface"
ITensorsZygoteRulesExt = "ZygoteRules"

Expand All @@ -58,6 +60,7 @@ SimpleTraits = "0.9.4"
SparseArrays = "<0.0.1, 1.10"
StaticArrays = "0.12, 1.0"
Strided = "1.1, 2"
TensorOperations = "5.1.4"
TimerOutputs = "0.5.5"
TupleTools = "1.2"
VectorInterface = "0.4, 0.5"
Expand All @@ -68,5 +71,6 @@ julia = "1.10"
[extras]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
14 changes: 14 additions & 0 deletions ext/ITensorsTensorOperationsExt/ITensorsTensorOperationsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module ITensorsTensorOperationsExt

using ITensors: ITensors, ITensor, dim, inds
using NDTensors.AlgorithmSelection: @Algorithm_str
using TensorOperations: TensorOperations, optimaltree

function ITensors.optimal_contraction_sequence(As::Union{Vector{<:ITensor},Tuple{Vararg{ITensor}}})
network = collect.(inds.(As))
inds_to_dims = Dict(i => Float64(dim(i)) for i in unique(reduce(vcat, network)))
seq, _ = optimaltree(network, inds_to_dims)
return seq
end

end
4 changes: 1 addition & 3 deletions src/ITensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ Documentation: https://itensor.github.io/ITensors.jl/stable/
module ITensors
include("usings.jl")
include("utils.jl")
include("lib/ContractionSequenceOptimization/src/ContractionSequenceOptimization.jl")
# TODO: `using .ContractionSequenceOptimization: ContractionSequenceOptimization, ...`.
using .ContractionSequenceOptimization
include("lib/LazyApply/src/LazyApply.jl")
# TODO: `using .LazyApply: LazyApply, ...`.
using .LazyApply
Expand Down Expand Up @@ -105,6 +102,7 @@ include("indexset.jl")
include("itensor.jl")
include("qn/flux.jl")
include("oneitensor.jl")
include("tensor_operations/contraction_cost.jl")
include("tensor_operations/tensor_algebra.jl")
include("tensor_operations/matrix_algebra.jl")
include("tensor_operations/permutations.jl")
Expand Down
3 changes: 0 additions & 3 deletions src/imports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ import Base.Broadcast:
broadcastable,
instantiate

import ITensors.ContractionSequenceOptimization:
contraction_cost, optimal_contraction_sequence

import Adapt: adapt_structure, adapt_storage

import LinearAlgebra:
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading