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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "TensorAlgebra"
uuid = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a"
version = "0.11.0"
version = "0.11.1"
authors = ["ITensor developers <support@itensor.org> and contributors"]

[workspace]
Expand Down
13 changes: 11 additions & 2 deletions src/matricize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,17 @@ function unmatricizeadd!(
invperm_codomain::Tuple{Vararg{Int}}, invperm_domain::Tuple{Vararg{Int}},
α::Number, β::Number
)
a = unmatricize(style, m, axes(a_dest), invperm_codomain, invperm_domain)
return add!(a_dest, a, α, β)
invbiperm = BiTuple(invperm_codomain, invperm_domain)
ndims(a_dest) == length(invbiperm) ||
throw(ArgumentError("destination does not match permutation"))
# Reshape `m` to the destination's matricized axes (a view), then permute it
# straight into `a_dest` with accumulation in a single pass, rather than
# allocating a permuted copy and then adding it. Mirrors `unmatricize!`.
a_perm = unmatricize(style, m, bipartition(axes(a_dest), invbiperm)...)
biperm_dest = BiTuple(Tuple(invperm(invbiperm)), Val(length_codomain(axes(a_dest))))
return bipermutedimsopadd!(
a_dest, identity, a_perm, biperm_dest.t1, biperm_dest.t2, α, β
)
end

# Defaults to ReshapeFusion, a simple reshape
Expand Down
Loading