Skip to content

Commit

Permalink
Merge d814a0d into 566dc79
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Oct 17, 2019
2 parents 566dc79 + d814a0d commit 47a596e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/linear_algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,20 @@ function mutable_operate_to!(C::Vector, ::typeof(*), A::AbstractMatrix, B::Abstr

Astride = size(A, 1)
@inbounds begin
for i = 1:mA
C[i] = zero!(C[i])
end
for i = 1:mA
C[i] = zero!(C[i])
end

# We need a buffer to hold the intermediate multiplication.
mul_buffer = zero(promote_operation(*, eltype(A), eltype(B)))
@inbounds for k = Base.OneTo(mB)
aoffs = (k-1) * Astride
b = B[k]
for i = Base.OneTo(mA)
# `C[i] = muladd_buf!(mul_buffer, C[i], A[aoffs + i], b)`
mutable_buffered_operate!(mul_buffer, add_mul, C[i], A[aoffs + i], b)
# We need a buffer to hold the intermediate multiplication.
mul_buffer = zero(promote_operation(*, eltype(A), eltype(B)))
for k = Base.OneTo(mB)
aoffs = (k-1) * Astride
b = B[k]
for i = Base.OneTo(mA)
mutable_buffered_operate!(mul_buffer, add_mul, C[i], A[aoffs + i], b)
end
end
end
end
end # @inbounds
return C
end

Expand Down

0 comments on commit 47a596e

Please sign in to comment.