From 7aa6867db64682c2ba9a5467b2278e219535eacb Mon Sep 17 00:00:00 2001 From: Benedikt Kloss Date: Thu, 2 Nov 2023 17:41:45 -0400 Subject: [PATCH 1/2] Fixes bug in svdMPO. Replaces vector (rightmaps) of references to same instance of Dict with vector of independent Dicts. --- src/physics/autompo/opsum_to_mpo.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/physics/autompo/opsum_to_mpo.jl b/src/physics/autompo/opsum_to_mpo.jl index 1388fe91f9..54f8c4e435 100644 --- a/src/physics/autompo/opsum_to_mpo.jl +++ b/src/physics/autompo/opsum_to_mpo.jl @@ -16,8 +16,7 @@ function svdMPO(ValType::Type{<:Number}, os::OpSum{C}, sites; kwargs...)::MPO wh return (only(site(t[1])) <= n <= only(site(t[end]))) end - rightmaps = fill(Dict{Vector{Op},Int}(), N) - + rightmaps = [Dict{Vector{Op},Int}() for _ in 1:N] for n in 1:N leftbond_coefs = MatElem{ValType}[] From ecbbcae2b9ee83fbcbb55b695aefe66fd50d9373 Mon Sep 17 00:00:00 2001 From: Benedikt Kloss Date: Thu, 2 Nov 2023 18:24:37 -0400 Subject: [PATCH 2/2] Format. --- src/physics/autompo/opsum_to_mpo.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/physics/autompo/opsum_to_mpo.jl b/src/physics/autompo/opsum_to_mpo.jl index 54f8c4e435..892ac4a88f 100644 --- a/src/physics/autompo/opsum_to_mpo.jl +++ b/src/physics/autompo/opsum_to_mpo.jl @@ -17,6 +17,7 @@ function svdMPO(ValType::Type{<:Number}, os::OpSum{C}, sites; kwargs...)::MPO wh end rightmaps = [Dict{Vector{Op},Int}() for _ in 1:N] + for n in 1:N leftbond_coefs = MatElem{ValType}[]