comparison stencil.jl @ 43:ef060ab3b035

remove stride and remove some bugs
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 10 Jan 2019 16:30:54 +0100
parents 64530c07165b
children 7fd4e7a1cd38 8cd8d83b92e7
comparison
equal deleted inserted replaced
40:8b04efde1a46 43:ef060ab3b035
22 else 22 else
23 return 0 23 return 0
24 end 24 end
25 end 25 end
26 26
27 function apply(s::Stencil, v::AbstractVector, i::Int; stride::Int = 1) 27 function apply(s::Stencil, v::AbstractVector, i::Int)
28 w = zero(eltype(v)) 28 w = zero(eltype(v))
29 for j ∈ i .+ stride.*(s.range[1]:s.range[2]) 29 for j ∈ s.range[1]:s.range[2]
30 w += v[j] 30 w += s[j]*v[i+j]
31 end 31 end
32 return w 32 return w
33 end 33 end