Mercurial > repos > public > sbplib_julia
comparison 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 |
comparison
equal
deleted
inserted
replaced
31:f2842e08d813 | 32:64530c07165b |
---|---|
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) | 27 function apply(s::Stencil, v::AbstractVector, i::Int; stride::Int = 1) |
28 w = zero(v[0]) | 28 w = zero(eltype(v)) |
29 for j ∈ i+(s.range[1]:s.range[2]) | 29 for j ∈ i .+ stride.*(s.range[1]:s.range[2]) |
30 w += v[j] | 30 w += v[j] |
31 end | 31 end |
32 return w | 32 return w |
33 end | 33 end |