Skip to content

Commit

Permalink
Fix expectation_values
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Jul 9, 2024
1 parent 020de0b commit f9783dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/operators/transferpepo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,13 @@ end
function MPSKit.expectation_value(
st::MPSMultiline, opp::TransferPEPOMultiline, ca::MPSKit.PerMPOInfEnv
)
retval = prod(product(1:size(st, 1), 1:size(st, 2))) do (i, j)
return prod(product(1:size(st, 1), 1:size(st, 2))) do (i, j)
O_ij = opp[i, j]
N = height(opp[1]) + 4
# just reuse left environment contraction
GL´ = transfer_left(leftenv(ca, i, j, st), O_ij, st.AC[i, j], st.AC[i + 1, j])
retval[i, j] = TensorOperations.tensorscalar(
return TensorOperations.tensorscalar(
ncon([GL´, rightenv(ca, i, j, st)], [[N, (2:(N - 1))..., 1], [(1:N)...]])
)
end
return retval
end
5 changes: 2 additions & 3 deletions src/operators/transferpeps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,15 @@ end
function MPSKit.expectation_value(
st::MPSMultiline, opp::TransferPEPSMultiline, ca::MPSKit.PerMPOInfEnv
)
retval = prod(product(1:size(st, 1), 1:size(st, 2))) do (i, j)
return prod(product(1:size(st, 1), 1:size(st, 2))) do (i, j)
O_ij = opp[i, j]
retval[i, j] = @tensor leftenv(ca, i, j, st)[1 2 4; 7] *
return @tensor leftenv(ca, i, j, st)[1 2 4; 7] *
conj(st.AC[i + 1, j][1 3 6; 13]) *
O_ij[1][5; 8 11 3 2] *
conj(O_ij[2][5; 9 12 6 4]) *
st.AC[i, j][7 8 9; 10] *
rightenv(ca, i, j, st)[10 11 12; 13]
end
return retval
end

@doc """
Expand Down

0 comments on commit f9783dc

Please sign in to comment.