diff --git a/Project.toml b/Project.toml index 0f53689..2013885 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] @@ -51,7 +51,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"