Skip to content

Commit c95a9f0

Browse files
authored
Fix dot(::FiniteMPS, ::FiniteMPO, ::FiniteMPS) for bra != ket (#264)
Correction of TensorKit.dot function. It was incorrect for bra \neq ket case. This was problematic for non-Hermitian calculations.
1 parent 5fcd93e commit c95a9f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/operators/mpo.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,14 @@ function TensorKit.dot(bra::FiniteMPS{T}, mpo::FiniteMPO{<:MPOTensor},
290290
# right half
291291
ρ_right = isomorphism(storagetype(T),
292292
right_virtualspace(ket, N) right_virtualspace(mpo, N),
293-
right_virtualspace(ket, length(ket)))
293+
right_virtualspace(bra, N))
294294
T_right = TransferMatrix(ket.AR[(Nhalf + 1):end], mpo[(Nhalf + 1):end],
295295
bra.AR[(Nhalf + 1):end])
296296
ρ_right = T_right * ρ_right
297297

298298
# center
299299
return @plansor ρ_left[3 4; 1] * ket.C[Nhalf][1; 5] * ρ_right[5 4; 2] *
300-
conj(ket.C[Nhalf][3; 2])
300+
conj(bra.C[Nhalf][3; 2])
301301
end
302302
function TensorKit.dot(bra::InfiniteMPS, mpo::InfiniteMPO, ket::InfiniteMPS;
303303
ishermitian=false, krylovdim=30, kwargs...)

0 commit comments

Comments
 (0)