comparison stencil.jl @ 88:170e5447bc19 patch_based_test

Reduce allocations
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 25 Jan 2019 15:10:41 +0100
parents 38733e84ef1a
children c0729ade65da
comparison
equal deleted inserted replaced
87:38733e84ef1a 88:170e5447bc19
29 @inbounds weight = s[j] 29 @inbounds weight = s[j]
30 w += weight*v[i+j] 30 w += weight*v[i+j]
31 end 31 end
32 return w 32 return w
33 end 33 end
34
35 Base.@propagate_inbounds function applybackwards(s::Stencil, v::AbstractVector, i::Int)
36 w = zero(eltype(v))
37 for j ∈ s.range[1]:s.range[2]
38 @inbounds weight = s[j]
39 w += weight*v[i-j]
40 end
41 return w
42 end