Skip to content

Commit

Permalink
Fix trace test
Browse files Browse the repository at this point in the history
  • Loading branch information
kmp5VT committed May 17, 2024
1 parent 1353fac commit b37f697
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/base/test_itensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,19 @@ end
@test ndims(A) == 0
end

@testset "trace (tr) (eltype=$elt)" for elt in (Float32, Float64, Complex{Float32}, Complex{Float64})
@testset "trace (tr) (eltype=$elt)" for elt in (
Float32, Float64, Complex{Float32}, Complex{Float64}
)
i, j, k, l = Index.((2, 3, 4, 5), ("i", "j", "k", "l"))
T = random_itensor(ElType, j, k', i', k, j', i)
T = random_itensor(elt, j, k', i', k, j', i)
trT1 = tr(T)
trT2 = (T * δ(ElType, i, i') * δ(ElType, j, j') * δ(ElType, k, k'))[]
trT2 = (T * δ(elt, i, i') * δ(elt, j, j') * δ(elt, k, k'))[]
@test trT1 trT2

T = random_itensor(ElType, j, k', i', l, k, j', i)
T = random_itensor(elt, j, k', i', l, k, j', i)
trT1 = tr(T)
@test eltype(trT1) === elt
trT2 = T * δ(ElType, i, i') * δ(ElType, j, j') * δ(ElType, k, k')
trT2 = T * δ(elt, i, i') * δ(elt, j, j') * δ(elt, k, k')
@test trT1 trT2
end

Expand Down

0 comments on commit b37f697

Please sign in to comment.