LinearAlgebra.jl
LinearAlgebra.jl copied to clipboard
Don't zero out destination in generic_matvecmul
Currently, mul!(c::AbstractVector, A::AbstractMatrix, b::AbstractVector) is computed (schematically) as
c .= 0 # zero of the correct type
for y in eachcol(A .* permutedims(b))
c .+= y
end
Filling c with zeros at the beginning is unnecessary. We may instead start by storing first(eachcol(A .* permutedims(b))) directly in c, followed by a loop over the other columns. This reduces one loop over c, although the difference in performance is minimal.