JoeyT1994 / ITensorNumericalAnalysis.jl

MIT License
3 stars 0 forks source link

ITensorNetworkFunction constructor does not have correct siteinds #34

Open ryanlevy opened 2 months ago

ryanlevy commented 2 months ago

The following conversion will fail to contract properly

let
     L = 10
     g = named_grid((L, 1))
     s = continuous_siteinds(g; map_dimension=2)

     x0, y0 = 0.5, 0.0
     ψ = delta_xyz(s, [x0, y0], [1, 2])
     @assert calculate_fxyz(ψ, [x0, y0], [1, 2]) ≈ 1
     # test random point
     @assert calculate_fxyz(ψ, [y0, x0], [1, 2]) ≈ 0

     # convert to itensornetwork then back, passing s
     ψ2 = ITensorNetworkFunction(itensornetwork(ψ),s)
     @assert calculate_fxyz(ψ2, [x0, y0], [1, 2])≈ 1
     @assert calculate_fxyz(ψ2, [y0, x0], [1, 2]) ≈ 0

     # **The problem!**
     ψ3 = ITensorNetworkFunction(itensornetwork(ψ))
     @assert calculate_fxyz(ψ3, [x0, y0], [1, 2]) ≈ 1 # zero, error
     @assert calculate_fxyz(ψ3, [y0, x0], [1, 2]) ≈ 0
end

I assume its from the siteinds, but haven't investigated further