Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/fitalgorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import Base: copy
"""
Contract M1 and M2, and return the result as an MPO.
"""
function contract_fit(M1::MPO, M2::MPO; init = nothing, kwargs...)::MPO
function contract_fit(M1::MPO, M2::MPO; init = nothing, nsweeps=1, kwargs...)::MPO
M2_ = MPS([M2[v] for v in eachindex(M2)])
if init === nothing
init_MPO::MPO = ITensors.contract(M1, M2; alg = "zipup", kwargs...)
init = MPS([init_MPO[v] for v in eachindex(init_MPO)])
else
init = MPS([init[v] for v in eachindex(M2)])
end
M12_ = contract_fit(M1, M2_; init_mps = init, kwargs...)
M12_ = contract_fit(M1, M2_; init_mps = init, nsweeps = nsweeps, kwargs...)
M12 = MPO([M12_[v] for v in eachindex(M1)])

return M12
Expand Down
2 changes: 2 additions & 0 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function _log_or_not_dot(y::MPO, A::MPO, x::MPO, loginner::Bool; kwargs...)::Num
sim!(linkinds, ydag)
check_hascommoninds(siteinds, A, y)
O = ydag[1] * A[1] * x[1]

log_inner_tot = 0.0
if loginner
normO = norm(O)
log_inner_tot = log(normO)
Expand Down
Loading