total += a
matches with total = a + total
, which is a vectorized type operation:
out = similar(a)
for i in eachindex(a)
out[i] = total[i] + a[i]
end
total = out
as inside
total = +(total,a)
, MATLAB, Python R , , , , =
total
. , - NumPy , Python, C (- !).
@. total += a
total .= total .+ a
. , Julia , , :
f! = (a,b,c) -> (a[i] = b[i] + c[i])
for i in eachindex(a)
f!(total,total,a)
end
total
.
Fusion Julia : broadcast!
( , ) , , . . broadcast!
f!
, GPUArrays.jl , . MATLAB, Python R, , , , , .