I am trying to calculate the sum of the absolute differences between two vectors without allocation. I have no experience with @simd
but was wondering if this is a correct use:
function sum_absdiff(x::Vector{T}, y::Vector{T}) where {T}
s = zero(T)
@simd for i in eachindex(x)
s += abs(x[i] - y[i])
end
return s
end