Skip to content

Commit

Permalink
Tests tr over different eltypes
Browse files Browse the repository at this point in the history
  • Loading branch information
kmp5VT committed May 17, 2024
1 parent d6bf137 commit 6e2e975
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/base/test_itensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,16 @@ end
@test ndims(A) == 0
end

@testset "trace (tr)" begin
@testset "trace (tr)" for ElType in (Float32, Float64, ComplexF32, ComplexF64)
i, j, k, l = Index.((2, 3, 4, 5), ("i", "j", "k", "l"))
T = random_itensor(j, k', i', k, j', i)
T = random_itensor(ElType, j, k', i', k, j', i)
trT1 = tr(T)
trT2 = (T * δ(i, i') * δ(j, j') * δ(k, k'))[]
trT2 = (T * δ(ElType, i, i') * δ(ElType, j, j') * δ(ElType, k, k'))[]
@test trT1 trT2

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

Expand Down

0 comments on commit 6e2e975

Please sign in to comment.