From 329c0e4b81a90e91ce41ed95492c1073159ca59f Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Tue, 30 Jun 2026 09:56:22 -0400 Subject: [PATCH 1/2] Map IndexName to Int for contraction --- Project.toml | 8 ++++++-- src/index.jl | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index b34ba28..83ba76c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ITensorBase" uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7" -version = "0.9.0" +version = "0.9.1" authors = ["ITensor developers and contributors"] [workspace] @@ -31,6 +31,10 @@ BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" +[sources.TensorAlgebra] +rev = "mf/contract-int-labels" +url = "https://github.com/ITensor/TensorAlgebra.jl" + [extensions] ITensorBaseAdaptExt = "Adapt" ITensorBaseBlockArraysExt = "BlockArrays" @@ -52,7 +56,7 @@ Mooncake = "0.4.202, 0.5" OrderedCollections = "1.6" Random = "1.10" SimpleTraits = "0.9.4" -TensorAlgebra = "0.12.4, 0.13" +TensorAlgebra = "0.13.4" TensorOperations = "5.3.1" TermInterface = "2" TupleTools = "1.6" diff --git a/src/index.jl b/src/index.jl index d65e591..a709c64 100644 --- a/src/index.jl +++ b/src/index.jl @@ -1,5 +1,6 @@ using Accessors: @set using Random: AbstractRNG, RandomDevice +using TensorAlgebra: TensorAlgebra as TA using UUIDs: UUID, uuid4 tagpairstring(pair::Pair) = string(first(pair)) * "=>" * string(last(pair)) @@ -39,6 +40,11 @@ function uniquename(rng::AbstractRNG, ::Type{<:IndexName}) return IndexName(rng) end +# Derive contractions on integer labels: an `IndexName` carries an id and a tag dictionary and is +# far costlier to compare than an integer, and deriving a contraction makes several comparison +# passes over the labels. See `TensorAlgebra.label_type`. +TA.label_type(::Type{<:IndexName}) = Int + to_symbol_pair(p::Pair) = Symbol(first(p)) => Symbol(last(p)) # Like `Dict`, accept one or more bare `Pair`s as tags. A `Pair` iterates over From 6e5eb1abbb688cc2154229cd8e903ca75f1a2d3c Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Tue, 30 Jun 2026 10:40:35 -0400 Subject: [PATCH 2/2] Remove the TensorAlgebra [sources] pin --- Project.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Project.toml b/Project.toml index 83ba76c..537dc3d 100644 --- a/Project.toml +++ b/Project.toml @@ -31,10 +31,6 @@ BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" -[sources.TensorAlgebra] -rev = "mf/contract-int-labels" -url = "https://github.com/ITensor/TensorAlgebra.jl" - [extensions] ITensorBaseAdaptExt = "Adapt" ITensorBaseBlockArraysExt = "BlockArrays"