Skip to content

Commit

Permalink
formatting and more allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoms committed May 8, 2024
1 parent 614adfd commit d323dfe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Cones/arrayutilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@ function eig_dot_kron!(
scals = (R <: Complex{T} ? [rt2i, rt2i * im] : [rt2i]) # real and imag parts

col_idx = 1
@inbounds for j in 1:size(inner,1)
@views V_j = V[:,j]
@inbounds for j in 1:size(inner, 1)
@views V_j = V[:, j]
for i in 1:(j - 1), scal in scals
@views V_i = V[:,i]
@views V_i = V[:, i]
mul!(temp1, V_j, V_i', scal, false)
@. temp2 = inner * (temp1 + temp1')
mul!(temp1, Hermitian(temp2, :U), V)
Expand Down
11 changes: 6 additions & 5 deletions src/Cones/epitrrelentropytri.jl
Original file line number Diff line number Diff line change
Expand Up @@ -578,31 +578,32 @@ function d2zdV2!(
) where {T <: Real, R <: RealOrComplex{T}}
d = size(vecs, 1)
V = copyto!(mat, vecs')
V_views = [view(V, :, i) for i in 1:d]
rt2i = inv(rt2)
scals = (R <: Complex{T} ? [rt2i, rt2i * im] : [rt2i])

col_idx = 1
@inbounds for j in 1:d
@views V_j = V[:, j]
for i in 1:(j - 1), scal in scals
mul!(mat3, V_views[j], V_views[i]', scal, false)
@views V_i = V[:, i]
mul!(mat3, V_j, V_i', scal, false)
@. mat2 = mat3 + mat3'
for k in 1:d
@views mul!(mat3[:, k], Wsim_Δ3[:, :, k], mat2[:, k])
end
# mat2 = vecs * (mat3 + mat3) * vecs'
@. mat2 = mat3 + mat3'
spectral_outer!(mat2, V', Hermitian(mat2, :U), mat3)
spectral_outer!(mat2, vecs, Hermitian(mat2, :U), mat3)
@views smat_to_svec!(d2zdV2[:, col_idx], mat2, rt2)
col_idx += 1
end

mul!(mat2, V_views[j], V_views[j]')
mul!(mat2, V_j, V_j')
for k in 1:d
@views mul!(mat3[:, k], Wsim_Δ3[:, :, k], mat2[:, k])
end
@. mat2 = mat3 + mat3'
spectral_outer!(mat2, V', Hermitian(mat2, :U), mat3)
spectral_outer!(mat2, vecs, Hermitian(mat2, :U), mat3)
@views smat_to_svec!(d2zdV2[:, col_idx], mat2, rt2)
col_idx += 1
end
Expand Down

0 comments on commit d323dfe

Please sign in to comment.