Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/stencil.jl @ 1065:fdd594b2a15e feature/nested_stencils
Fix type instability in apply_stencil_backwards and add tests
(grafted from a3bc90c59e8e89de3535c7767963f3a3010c4f4c)
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 15 Feb 2022 08:08:19 +0100 |
parents | f98893154e22 |
children | 14cb97284373 |
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl Tue Feb 15 07:54:52 2022 +0100 +++ b/src/SbpOperators/stencil.jl Tue Feb 15 08:08:19 2022 +0100 @@ -78,7 +78,7 @@ end Base.@propagate_inbounds @inline function apply_stencil_backwards(s::Stencil, v::AbstractVector, i::Int) - w = zero(eltype(v)) + w = zero(promote_type(eltype(s),eltype(v))) @simd for k ∈ length(s):-1:1 w += s.weights[k]*v[i - s.range[k]] end