Skip to content

Commit 8a00e4a

Browse files
Fix cutoff bug
1 parent 8eef52b commit 8a00e4a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/contractMPO.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
function contract_mpo_mpo(M1::MPO, M2::MPO; alg::String = "densitymatrix", kwargs...)::MPO
1+
function contract_mpo_mpo(M1::MPO, M2::MPO; alg::String="densitymatrix", kwargs...)::MPO
22
if alg == "densitymatrix"
33
return contract_densitymatrix(M1, M2; kwargs...)
44
elseif alg == "fit"
55
return contract_fit(M1, M2; kwargs...)
66
elseif alg == "zipup"
7-
return ITensors.contract(M1, M2; alg = "zipup", kwargs...)
7+
return ITensors.contract(M1, M2; alg="zipup", kwargs...)
88
elseif alg == "naive"
9-
return ITensors.contract(M1, M2; alg = "naive", kwargs...)
9+
return ITensors.contract(M1, M2; alg="naive", kwargs...)
1010
else
1111
error("Unknown algorithm: $alg")
1212
end
@@ -21,7 +21,7 @@ function apply(A::MPO, Ψ::MPO; alg::String="fit", cutoff::Real=1e-25, kwargs...
2121
@warn "cutoff is too small for densitymatrix algorithm. Use fit algorithm instead."
2222
end
2323
= replaceprime(
24-
contract_mpo_mpo(A', MPO(collect(Ψ)); alg, kwargs...), 2 => 1)
24+
contract_mpo_mpo(A', MPO(collect(Ψ)); alg, cutoff, kwargs...), 2 => 1)
2525
MPO(collect(AΨ))
2626
end
2727

@@ -33,6 +33,6 @@ function apply(A::MPO, Ψ::MPS; alg::String="fit", cutoff::Real=1e-25, kwargs...
3333
if alg == "densitymatrix" && cutoff <= 1e-10
3434
@warn "cutoff is too small for densitymatrix algorithm. Use fit algorithm instead."
3535
end
36-
= noprime.(contract_mpo_mpo(A, MPO(collect(Ψ)); alg, kwargs...))
36+
= noprime.(contract_mpo_mpo(A, MPO(collect(Ψ)); alg, cutoff, kwargs...))
3737
MPS(collect(AΨ))
3838
end

0 commit comments

Comments
 (0)