Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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,7 +1,7 @@
name = "TensorOperations"
uuid = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
authors = ["Lukas Devos <[email protected]>", "Maarten Van Damme <[email protected]>", "Jutho Haegeman <[email protected]>"]
version = "5.3.0"
version = "5.3.1"

[deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Expand Down
6 changes: 3 additions & 3 deletions src/indexnotation/instantiators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ function instantiate_linearcombination(
)
out = Expr(:block)
if alloc ∈ (NewTensor, TemporaryTensor)
if scaltype === nothing
scaltype = instantiate_scalartype(ex)
end
scaltype = @something(
scaltype, instantiate_scalartype(α === One() ? ex : Expr(:call, :*, α, ex))
)
push!(
out.args,
instantiate(dst, β, ex.args[2], α, leftind, rightind, alloc, scaltype)
Expand Down
11 changes: 11 additions & 0 deletions test/tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -581,4 +581,15 @@ end
@test isblascontractable(pA, p)
@test isblascontractable(conj(pA), p)
end

@testset "Issue 220" begin
A = rand(2, 2)
B = rand(2, 2)
C = rand(2, 2)
D = rand(2, 2)
c = 1im
@tensor E[a; c] := c * (A[a b] * B[b c] + C[a b] * D[b c])
@test scalartype(E) == ComplexF64
@test E ≈ c * (A * B + C * D)
end
end
Loading