Skip to content

Commit

Permalink
Observer function name disambiguation
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Oct 23, 2024
1 parent 6ec477c commit 8f54192
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/observer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ energy after each sweep.
"""
energies(o::DMRGObserver) = o.energies

sites(obs::DMRGObserver) = obs.sites
observer_sites(obs::DMRGObserver) = obs.sites

ops(obs::DMRGObserver) = obs.ops
observer_ops(obs::DMRGObserver) = obs.ops

truncerrors(obs::DMRGObserver) = obs.truncerrs

function measurelocalops!(obs::DMRGObserver, wf::ITensor, i::Int)
for o in ops(obs)
for o in observer_ops(obs)
# Moves to GPU if needed
oⱼ = adapt(datatype(wf), op(sites(obs), o, i))
oⱼ = adapt(datatype(wf), op(observer_sites(obs), o, i))
m = dot(wf, apply(oⱼ, wf))
imag(m) > 1e-8 && (@warn "encountered finite imaginary part when measuring $o")
measurements(obs)[o][end][i] = real(m)
Expand All @@ -155,7 +155,7 @@ function measure!(obs::DMRGObserver; kwargs...)
N = length(psi)

if b == (N - 1)
for o in ops(obs)
for o in observer_ops(obs)
push!(measurements(obs)[o], zeros(N))
end
push!(truncerrors(obs), 0.0)
Expand Down

0 comments on commit 8f54192

Please sign in to comment.