Mercurial > repos > public > sbplib_julia
changeset 37:5cefb9a55a50
merge with default
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Thu, 10 Jan 2019 14:49:30 +0100 |
parents | 8a30ea842c8e (current diff) 64530c07165b (diff) |
children | 5ec57ec148ef |
files | |
diffstat | 3 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/diffOp.jl Thu Jan 10 14:48:50 2019 +0100 +++ b/diffOp.jl Thu Jan 10 14:49:30 2019 +0100 @@ -29,7 +29,7 @@ end # u = L*v -function apply(L::Laplace1D, u::AbstractVector, v::AbstractVector) +function apply!(L::Laplace1D, u::AbstractVector, v::AbstractVector) N = closureSize(L.op) M = length(v)
--- a/grid.jl Thu Jan 10 14:48:50 2019 +0100 +++ b/grid.jl Thu Jan 10 14:49:30 2019 +0100 @@ -117,4 +117,10 @@ end end +# Evaluate function f on the grid g +function evalOn(g::Grid, f::Function) + F(x) = f(x...) + return F.(points(g)) end + +end
--- a/stencil.jl Thu Jan 10 14:48:50 2019 +0100 +++ b/stencil.jl Thu Jan 10 14:49:30 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