Skip to content

Commit c66fe0d

Browse files
author
Marc Ritter
committed
Merge branch '39-sum-over-physical-indices' into 'main'
Fix: spurious conjugate in `sum` function See merge request tensors4fields/TensorCrossInterpolation.jl!76
2 parents 9bf423e + 583de33 commit c66fe0d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/abstracttensortrain.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Evaluates the sum of the tensor train approximation over all lattice sites in an
165165
factorized manner.
166166
"""
167167
function sum(tt::AbstractTensorTrain{V}) where {V}
168-
v = sum(tt[1], dims=(1, 2))[1, 1, :]'
168+
v = transpose(sum(tt[1], dims=(1, 2))[1, 1, :])
169169
for T in tt[2:end]
170170
v *= sum(T, dims=2)[:, 1, :]
171171
end

test/test_tensortrain.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ using Zygote
44
using Optim
55

66
@testset "tensor train" begin
7-
g(v) = 1 / (sum(v .^ 2) + 1)
7+
g(v) = 1 / (sum(v .^ 2) + 1im)
88
localdims = (6, 6, 6, 6)
99
tolerance = 1e-8
1010
allindices = CartesianIndices(localdims)
1111

12-
tci, ranks, errors = TCI.crossinterpolate1(Float64, g, localdims; tolerance=tolerance)
12+
tci, ranks, errors = TCI.crossinterpolate1(ComplexF64, g, localdims; tolerance=tolerance)
1313
tt = TCI.TensorTrain(tci)
1414
@test TCI.rank(tci) == TCI.rank(tt)
1515
@test TCI.linkdims(tci) == TCI.linkdims(tt)
16-
gsum = 0.0
16+
gsum = ComplexF64(0.0)
1717
for i in allindices
1818
@test TCI.evaluate(tci, i) TCI.evaluate(tt, i)
1919
@test tt(i) == TCI.evaluate(tt, i)

0 commit comments

Comments
 (0)