Skip to content

Commit

Permalink
Fix Number type handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Kloss committed Jan 26, 2024
1 parent 8a1c87b commit 28371cc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/treetensornetworks/abstracttreetensornetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,13 @@ function expect(
# assuming that the next algorithmic step can make use of the orthogonality center being moved to a different vertex
sites = siteinds(state)
ordered_vertices = reverse(post_order_dfs_vertices(sites, root_vertex)) #ToDo: Verify that this is indeed the correct order for performance
ElT = promote_itensor_eltype(state)
res = Dictionary(vertices, Vector{ElT}(undef, length(vertices)))
res = Dictionary(vertices, undef)
for v in ordered_vertices
!(v in vertices) && continue #only compute expectation values for required vertices
!(v in vertices) && continue
state = orthogonalize(state, v)
@assert isone(length(sites[v]))
Op = ITensors.op(operator, only(sites[v])) #ToDo: Add compatibility with more than a single index per vertex
res[v] = scalar(dag(state[v]) * apply(Op, state[v]))
op_v = op(operator, only(sites[v])) #ToDo: Add compatibility with more than a single index per vertex
res[v] = scalar(dag(state[v]) * apply(op_v, state[v]))
end
return res
return mapreduce(typeof, promote_type, res).(res)
end

0 comments on commit 28371cc

Please sign in to comment.