Skip to content

Commit

Permalink
inline __muldiag_nonzeroalpha! for Diagonal destination
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Oct 28, 2024
1 parent a6557e2 commit 3e671bc
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions stdlib/LinearAlgebra/src/diagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -506,24 +506,17 @@ function __muldiag!(out, A, D::Diagonal, _add::MulAddMul)
return out
end

@inline function __muldiag_nonzeroalpha!(out::Diagonal, D1::Diagonal, D2::Diagonal, _add::MulAddMul)
function __muldiag!(out::Diagonal, D1::Diagonal, D2::Diagonal, _add::MulAddMul)
d1 = D1.diag
d2 = D2.diag
outd = out.diag
@inbounds @simd for i in eachindex(d1, d2, outd)
_modify!(_add, d1[i] * d2[i], outd, i)
end
out
end
function __muldiag!(out::Diagonal, D1::Diagonal, D2::Diagonal, _add::MulAddMul)
alpha, beta = _add.alpha, _add.beta
if iszero(alpha)
_rmul_or_fill!(out.diag, beta)
else
__muldiag_nonzeroalpha!(out, D1, D2, _add)
end
return out
end

@inline function __muldiag_nonzeroalpha!(out, D1::Diagonal, D2::Diagonal, _add::MulAddMul)
d1 = D1.diag
d2 = D2.diag
Expand Down

0 comments on commit 3e671bc

Please sign in to comment.