Skip to content

Commit

Permalink
Make copy on ProjectedTTN copy-safe. Workaround for issue ITensor#98
Browse files Browse the repository at this point in the history
…in Dictionaries.jl.
  • Loading branch information
b-kloss committed Jan 28, 2024
1 parent 05fb04c commit 5a00dd6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/treetensornetworks/projttns/projttn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function ProjTTN(H::TTN)
return ProjTTN(vertices(H), H, Dictionary{edgetype(H),ITensor}())
end

copy(P::ProjTTN) = ProjTTN(P.pos, copy(P.H), copy(P.environments))
copy(P::ProjTTN) = ProjTTN(P.pos, copy(P.H), NamedGraphs.copy_keys_values(P.environments))

# trivial if we choose to specify position as above; only kept to allow using alongside
# ProjMPO
Expand Down
2 changes: 1 addition & 1 deletion src/treetensornetworks/projttns/projttn_apply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function ProjTTNApply(psi0::TTN, H::TTN)
end

function copy(P::ProjTTNApply)
return ProjTTNApply(P.pos, copy(P.psi0), copy(P.H), copy(P.environments))
return ProjTTNApply(P.pos, copy(P.psi0), copy(P.H), NamedGraphs.copy_keys_values(P.environments))
end

function set_nsite(P::ProjTTNApply, nsite)
Expand Down

0 comments on commit 5a00dd6

Please sign in to comment.