From ea673d4c3c26f1adfdd118f81e6459c8b42826ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Ara=C3=BAjo?= Date: Sat, 9 Dec 2023 11:18:22 +0100 Subject: [PATCH] a bit more elegant --- src/math_util.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/math_util.jl b/src/math_util.jl index 35c4aff..c718b33 100644 --- a/src/math_util.jl +++ b/src/math_util.jl @@ -228,7 +228,7 @@ function partial_trace(ρ::AbstractMatrix, sys_dim::AbstractVector{<:Integer}, d re_dim[dim_2_trace] .= 1 tr_dim = copy(sys_dim) tr_dim[dim_2_keep] .= 1 - res = zeros(typeof(first(ρ)), re_dim..., re_dim...) + res = zeros(eltype(ρ), re_dim..., re_dim...) for I in CartesianIndices(size(res)) for k in CartesianIndices((tr_dim...,)) delta = CartesianIndex(k, k)