Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ITensorBase"
uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
version = "0.15.4"
version = "0.15.5"
authors = ["ITensor developers <support@itensor.org> and contributors"]

[workspace]
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
14 changes: 7 additions & 7 deletions src/abstractnamedtensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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(β))
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading