Mercurial > repos > public > sbplib_julia
diff stencil.jl @ 32:64530c07165b
Allow stride in apply stencil
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 10 Jan 2019 14:33:29 +0100 |
parents | 433008d3b7d3 |
children | ef060ab3b035 |
line wrap: on
line diff
--- a/stencil.jl Thu Jan 10 12:54:40 2019 +0100 +++ b/stencil.jl Thu Jan 10 14:33:29 2019 +0100 @@ -24,9 +24,9 @@ end end -function apply(s::Stencil, v::AbstractVector, i::Int) - w = zero(v[0]) - for j ∈ i+(s.range[1]:s.range[2]) +function apply(s::Stencil, v::AbstractVector, i::Int; stride::Int = 1) + w = zero(eltype(v)) + for j ∈ i .+ stride.*(s.range[1]:s.range[2]) w += v[j] end return w