From 36f0117c21064a51dab32470531c1b01ba235b33 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Fri, 2 Oct 2026 19:45:33 -0400 Subject: [PATCH 1/2] Follow the TensorAlgebra scaleadd! rename Tracks the rename of the four-argument `add!` in https://github.com/ITensor/TensorAlgebra.jl/pull/239. The VectorInterface methods keep the `add!` name, since that is VectorInterface's own interface. Co-Authored-By: Claude Opus 5 (1M context) --- Project.toml | 12 ++++++++++-- docs/Project.toml | 2 +- src/abstractnamedtensor.jl | 14 +++++++------- test/Project.toml | 2 +- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Project.toml b/Project.toml index 0f53689..e2bdf1b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ITensorBase" uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7" -version = "0.15.4" +version = "0.15.5" authors = ["ITensor developers and contributors"] [workspace] @@ -30,6 +30,14 @@ OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715" TensorKit = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec" TensorKitSectors = "13a9c161-d5da-41f0-bcbd-e1a08ae0647f" +[sources.GradedArrays] +rev = "mf/scaleadd" +url = "https://github.com/ITensor/GradedArrays.jl" + +[sources.TensorAlgebra] +rev = "mf/scaleadd" +url = "https://github.com/ITensor/TensorAlgebra.jl" + [extensions] ITensorBaseAdaptExt = "Adapt" ITensorBaseGradedArraysExt = ["GradedArrays", "TensorKitSectors"] @@ -51,7 +59,7 @@ Mooncake = "0.4.202, 0.5" OMEinsumContractionOrders = "1.3" Random = "1.10" SimpleTraits = "0.9.4" -TensorAlgebra = "0.22" +TensorAlgebra = "0.23" TensorKit = "0.17" TensorKitSectors = "0.3.9" TermInterface = "2" diff --git a/docs/Project.toml b/docs/Project.toml index 99795b2..2744e45 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -20,5 +20,5 @@ ITensorBase = "0.15" ITensorFormatter = "0.2.27" Literate = "2" MatrixAlgebraKit = "0.2, 0.3, 0.4, 0.5, 0.6" -TensorAlgebra = "0.22" +TensorAlgebra = "0.23" Test = "1.10" diff --git a/src/abstractnamedtensor.jl b/src/abstractnamedtensor.jl index 828f56b..ea100fb 100644 --- a/src/abstractnamedtensor.jl +++ b/src/abstractnamedtensor.jl @@ -274,19 +274,19 @@ Base.ndims(a::AbstractNamedTensor) = TensorAlgebra.ndims(unnamed(a)) # Circumvent issue when eltype isn't known at compile time. Base.eltype(a::AbstractNamedTensor) = eltype(unnamed(a)) -# In-place `zero!`/`scale!`/`add!` of a named tensor, delegating to the unnamed parent array. -# `add!` aligns `x` to `y`'s dimension order by name (the named analogue of the -# identity-permutation `add!` on plain arrays) and does the block-wise permute-add on the +# In-place `zero!`/`scale!`/`scaleadd!` of a named tensor, delegating to the unnamed parent array. +# `scaleadd!` aligns `x` to `y`'s dimension order by name (the named analogue of the +# identity-permutation `scaleadd!` on plain arrays) and does the block-wise permute-add on the # parents, so it never routes through a broadcast that aliases the destination with an operand. TensorAlgebra.zero!(a::AbstractNamedTensor) = (zero!(unnamed(a)); a) function TensorAlgebra.scale!(a::AbstractNamedTensor, α::Number) TensorAlgebra.scale!(unnamed(a), α) return a end -function TensorAlgebra.add!( +function TensorAlgebra.scaleadd!( y::AbstractNamedTensor, x::AbstractNamedTensor, α::Number, β::Number ) - TensorAlgebra.add!(unnamed(y), unnamed(x, names(y)), α, β) + TensorAlgebra.scaleadd!(unnamed(y), unnamed(x, names(y)), α, β) return y end @@ -317,7 +317,7 @@ function VI.scale(a::AbstractNamedTensor, α::Number) end VI.scale!(a::AbstractNamedTensor, α::Number) = TensorAlgebra.scale!(a, α) function VI.scale!(b::AbstractNamedTensor, a::AbstractNamedTensor, α::Number) - return TensorAlgebra.add!(b, a, α, false) + return TensorAlgebra.scaleadd!(b, a, α, false) end # The `!!` methods fall back to out-of-place allocation when the destination can't hold the result. function VI.scale!!(a::AbstractNamedTensor, α::Number) @@ -336,7 +336,7 @@ function VI.add(y::AbstractNamedTensor, x::AbstractNamedTensor, α::Number, β:: return VI.add!(VI.scale!(similar(y, T), y, β), x, α, true) end function VI.add!(y::AbstractNamedTensor, x::AbstractNamedTensor, α::Number, β::Number) - return TensorAlgebra.add!(y, x, α, β) + return TensorAlgebra.scaleadd!(y, x, α, β) end function VI.add!!(y::AbstractNamedTensor, x::AbstractNamedTensor, α::Number, β::Number) T = Base.promote_op(VI.add, VI.scalartype(y), VI.scalartype(x), typeof(α), typeof(β)) diff --git a/test/Project.toml b/test/Project.toml index 90741c8..aa6ef32 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -44,7 +44,7 @@ Random = "1.10" SafeTestsets = "0.1" StableRNGs = "1" Suppressor = "0.2" -TensorAlgebra = "0.22" +TensorAlgebra = "0.23" TensorKit = "0.17" TensorKitSectors = "0.3.9" TermInterface = "2" From 9ecb9278db5cce5e42c215ca1d2b6fa158aefabd Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Fri, 2 Oct 2026 21:42:22 -0400 Subject: [PATCH 2/2] Remove the branch pins now that TensorAlgebra 0.23 and GradedArrays 0.17.1 are registered Co-Authored-By: Claude Opus 5 (1M context) --- Project.toml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Project.toml b/Project.toml index e2bdf1b..2013885 100644 --- a/Project.toml +++ b/Project.toml @@ -30,14 +30,6 @@ OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715" TensorKit = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec" TensorKitSectors = "13a9c161-d5da-41f0-bcbd-e1a08ae0647f" -[sources.GradedArrays] -rev = "mf/scaleadd" -url = "https://github.com/ITensor/GradedArrays.jl" - -[sources.TensorAlgebra] -rev = "mf/scaleadd" -url = "https://github.com/ITensor/TensorAlgebra.jl" - [extensions] ITensorBaseAdaptExt = "Adapt" ITensorBaseGradedArraysExt = ["GradedArrays", "TensorKitSectors"]