comparison stencil.jl @ 81:7f72e7e14659 patch_based_test

Add benchmarktest and mark all apply functions with @inline and @inbounds
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 24 Jan 2019 14:58:22 +0100
parents 700a74c41b26
children 38733e84ef1a
comparison
equal deleted inserted replaced
80:700a74c41b26 81:7f72e7e14659
23 else 23 else
24 return eltype(s.weights)(0) 24 return eltype(s.weights)(0)
25 end 25 end
26 end 26 end
27 27
28 function apply(s::Stencil, v::AbstractVector, i::Int) 28 @inline function apply(s::Stencil, v::AbstractVector, i::Int)
29 w = zero(eltype(v)) 29 w = zero(eltype(v))
30 for j ∈ s.range[1]:s.range[2] 30 for j ∈ s.range[1]:s.range[2]
31 w += s[j]*v[i+j] # TBD: Make this without boundschecks? 31 @inbounds w += s[j]*v[i+j] # TBD: Make this without boundschecks?
32 end 32 end
33 return w 33 return w
34 end 34 end