Say I want to use a sliding window of width = N, such that in the first iteration I would write it as the range 1:N, and the start and stop values of the range would move j units after the j-th iteration. My first try would be:
for j=0:m
w = j+(1:N)
# etc
end
But testing against Julia 0.7 this issues the following warning:
Warning: `a::Number + b::AbstractArray` is deprecated, use `broadcast(+, a, b)` instead.
Following that advice is bad for performance (at least in Julia 0.6)
Thanks, that’s right. So I can rewrite my question as:
Is there a “nicer” (and non-deprecated) way to write broadcast(+, j, a:b), which gives the same result, as j + (a:b) did before 0.7?
In this small example I’m using fixed start and stop values. If possible I would also like to do it for shifting a range that is in a variable x, whose start and stop values (and perhaps step too) may be “unknown” beforehand.