changeset 32:64530c07165b

Allow stride in apply stencil
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Jan 2019 14:33:29 +0100
parents f2842e08d813
children e8d7137b3f07 5cefb9a55a50
files stencil.jl
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
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