Skip to content

Commit 847a9e0

Browse files
committed
fix full trace test for fermions
1 parent d04ba25 commit 847a9e0

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

test/tensors/tensors.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,28 +279,29 @@ for V in spacelist
279279
end
280280
@timedtestset "Full trace: test self-consistency" begin
281281
if symmetricbraiding
282-
t = rand(ComplexF64, V1 V2' V1 V2')
282+
t = rand(ComplexF64, V1 V2' V2 V1')
283+
t2 = permute(t, ((1, 2), (4, 3)))
284+
s = @constinferred tr(t2)
285+
@test conj(s) tr(t2')
283286
if !isdual(V1)
284-
t2 = twist!(t, 1)
287+
t2 = twist!(t2, 1)
285288
end
286289
if isdual(V2)
287-
t2 = twist!(t, 2)
290+
t2 = twist!(t2, 2)
288291
end
289-
s = @constinferred tr(t)
290292
ss = tr(t2)
291-
@tensor s2 = t[a b; a b]
292-
@tensor t3[a; b] := t[a c; b c]
293-
@tensor s3 = t3[a; a]
293+
@tensor s2 = t[a, b, b, a]
294+
@tensor t3[a, b] := t[a, c, c, b]
295+
@tensor s3 = t3[a, a]
294296
else
295297
t = rand(ComplexF64, V1 V2 V1 V2) # avoid permutes
296-
s = @constinferred tr(t)
297-
ss = s
298+
ss = @constinferred tr(t)
299+
@test conj(ss) tr(t')
298300
@planar s2 = t[a b; a b]
299301
@planar t3[a; b] := t[a c; b c]
300302
@planar s3 = t3[a; a]
301303
end
302304

303-
@test conj(s) tr(t')
304305
@test ss s2
305306
@test ss s3
306307
end

0 commit comments

Comments
 (0)