@@ -4,12 +4,6 @@ using ITensorMPS: ITensorMPS, expect
44
55default_expect_alg () = " bp"
66
7- function ITensorMPS. expect (
8- ψ:: AbstractITensorNetwork , ops; alg= default_expect_alg (), kwargs...
9- )
10- return expect (Algorithm (alg), ψ, ops; kwargs... )
11- end
12-
137function ITensorMPS. expect (
148 ψIψ:: AbstractFormNetwork , op:: Op ; contract_kwargs= (; sequence= " automatic" ), kwargs...
159)
@@ -24,27 +18,6 @@ function ITensorMPS.expect(
2418 return numerator / denominator
2519end
2620
27- function ITensorMPS. expect (
28- ψIψ:: AbstractFormNetwork ,
29- ops:: Scaled{ComplexF64,Prod{Op}} ;
30- contract_kwargs= (; sequence= " automatic" ),
31- kwargs... ,
32- )
33- scalar = first (ops. args)
34- iszero (scalar) && return 0.0
35- n_ops = length (ops)
36- vs = site .(ops[1 : n_ops])
37- op_strings = which_op .(ops[1 : n_ops])
38- ψIψ_vs = [ψIψ[operator_vertex (ψIψ, v)] for v in vs]
39- sinds = [commonind (ψIψ[ket_vertex (ψIψ, v)], ψIψ_vs[i]) for (i, v) in enumerate (vs)]
40- operators = [ITensors. op (op_strings[i], sinds[i]) for i in 1 : n_ops]
41- ∂ψIψ_∂v = environment (ψIψ, operator_vertices (ψIψ, vs); kwargs... )
42- numerator = contract (vcat (∂ψIψ_∂v, operators); contract_kwargs... )[]
43- denominator = contract (vcat (∂ψIψ_∂v, ψIψ_vs); contract_kwargs... )[]
44-
45- return scalar * numerator / denominator
46- end
47-
4821function ITensorMPS. expect (
4922 alg:: Algorithm ,
5023 ψ:: AbstractITensorNetwork ,
0 commit comments