comparison stencil.jl @ 94:84b1ad5a3755 stencil_index

Made everything work(?) but also go really slow. And also not type-stable.
author Ylva Rydin <ylva.rydin@telia.com>
date Mon, 04 Feb 2019 16:09:07 +0100
parents 93df72e2b135
children
comparison
equal deleted inserted replaced
93:93df72e2b135 94:84b1ad5a3755
17 return s.weights[1 + i - s.range[1]] 17 return s.weights[1 + i - s.range[1]]
18 end 18 end
19 19
20 Base.@propagate_inbounds function apply(s::Stencil, v::AbstractVector, i::Int) 20 Base.@propagate_inbounds function apply(s::Stencil, v::AbstractVector, i::Int)
21 w = zero(eltype(v)) 21 w = zero(eltype(v))
22 @show s.range[1]:s.range[2]
23 for j ∈ s.range[1]:s.range[2] 22 for j ∈ s.range[1]:s.range[2]
24 @inbounds weight = s[j] 23 @inbounds weight = s[j]
25 w += weight*v[i+j] 24 w += weight*v[i+j]
26 end 25 end
27 return w 26 return w