From 1ef03c5cb83d91938ee809309f09d2d42c703c95 Mon Sep 17 00:00:00 2001 From: Benedikt Kloss Date: Wed, 24 Jan 2024 19:13:00 -0500 Subject: [PATCH] Populate ITensor with zeros if empty after contracting with ProjTTN. --- src/treetensornetworks/projttns/abstractprojttn.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/treetensornetworks/projttns/abstractprojttn.jl b/src/treetensornetworks/projttns/abstractprojttn.jl index 9f6da826..09966f08 100644 --- a/src/treetensornetworks/projttns/abstractprojttn.jl +++ b/src/treetensornetworks/projttns/abstractprojttn.jl @@ -80,6 +80,10 @@ function contract(P::AbstractProjTTN, v::ITensor)::ITensor for it in itensor_map Hv *= it end + if isempty(Hv) + Hv = similar(v) + Hv .= 0 + end return Hv end