From db23164aba88b9d510fb6d7e317eda6d5fa4e664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jofre=20Vall=C3=A8s=20Muns?= <61060572+jofrevalles@users.noreply.github.com> Date: Thu, 12 Sep 2024 10:46:31 +0200 Subject: [PATCH] Fix error throw in `replace!` (#201) * Fix error throw for replace! * remove previous push line --- src/TensorNetwork.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TensorNetwork.jl b/src/TensorNetwork.jl index 2753a161..eb284e99 100644 --- a/src/TensorNetwork.jl +++ b/src/TensorNetwork.jl @@ -225,8 +225,8 @@ function Base.replace!(tn::AbstractTensorNetwork, pair::Pair{<:Tensor,<:Tensor}) old_tensor, new_tensor = pair issetequal(inds(new_tensor), inds(old_tensor)) || throw(ArgumentError("replacing tensor indices don't match")) - delete!(tn, old_tensor) push!(tn, new_tensor) + delete!(tn, old_tensor) return tn end