From 614adfde0cd4da9187f988d9a26cbe2f6ac850fc Mon Sep 17 00:00:00 2001 From: araujoms Date: Wed, 8 May 2024 19:07:04 +0200 Subject: [PATCH] remove more allocations --- src/Cones/arrayutilities.jl | 11 ++++++----- src/Cones/epitrrelentropytri.jl | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Cones/arrayutilities.jl b/src/Cones/arrayutilities.jl index 036951ddf..2f04f2251 100644 --- a/src/Cones/arrayutilities.jl +++ b/src/Cones/arrayutilities.jl @@ -382,16 +382,17 @@ function eig_dot_kron!( @assert issymmetric(inner) # must be symmetric (wrapper is less efficient) rt2i = inv(rt2) copyto!(V, vecs') # allows fast column slices - V_views = [view(V, :, i) for i in 1:size(inner, 1)] scals = (R <: Complex{T} ? [rt2i, rt2i * im] : [rt2i]) # real and imag parts col_idx = 1 - @inbounds for (j, V_j) in enumerate(V_views) + @inbounds for j in 1:size(inner,1) + @views V_j = V[:,j] for i in 1:(j - 1), scal in scals - mul!(temp1, V_j, V_views[i]', scal, false) + @views V_i = V[:,i] + mul!(temp1, V_j, V_i', scal, false) @. temp2 = inner * (temp1 + temp1') mul!(temp1, Hermitian(temp2, :U), V) - mul!(temp2, V', temp1) + mul!(temp2, vecs, temp1) @views smat_to_svec!(skr[:, col_idx], temp2, rt2) col_idx += 1 end @@ -399,7 +400,7 @@ function eig_dot_kron!( mul!(temp2, V_j, V_j') temp2 .*= inner mul!(temp1, Hermitian(temp2, :U), V) - mul!(temp2, V', temp1) + mul!(temp2, vecs, temp1) @views smat_to_svec!(skr[:, col_idx], temp2, rt2) col_idx += 1 end diff --git a/src/Cones/epitrrelentropytri.jl b/src/Cones/epitrrelentropytri.jl index 18817cb12..720d73874 100644 --- a/src/Cones/epitrrelentropytri.jl +++ b/src/Cones/epitrrelentropytri.jl @@ -413,7 +413,6 @@ function dder3( diff_dot_V_VV = cone.diff_dot_V_VV diff_dot_V_VW = cone.diff_dot_V_VW diff_dot_W_WW = cone.diff_dot_W_WW - Vvd = cone.Vvd Wwd = cone.Wwd VWwd = cone.VWwd