comparison diffOp.jl @ 6:cb8e50ca9e15

Add attempt att apply methods for Laplace
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 17 Dec 2018 14:18:22 +0100
parents 43be32298ae2
children 433008d3b7d3
comparison
equal deleted inserted replaced
5:2737156fb884 6:cb8e50ca9e15
1 abstract type DiffOp end 1 abstract type DiffOp end
2 2
3 function apply(D::DiffOp, v::AbstractVector) where N 3 function apply(D::DiffOp, v::AbstractVector)
4 error("not implemented") 4 error("not implemented")
5 end 5 end
6 6
7 function innerProduct(D::DiffOp, u::AbstractVector, v::AbstractVector)::Real 7 function innerProduct(D::DiffOp, u::AbstractVector, v::AbstractVector)::Real
8 error("not implemented") 8 error("not implemented")
26 grid 26 grid
27 a 27 a
28 op 28 op
29 end 29 end
30 30
31 function apply(L::Laplace, v::AbstractVector)::AbstractVector 31 # u = L*v
32 function apply(L::Laplace, u::AbstractVector, v::AbstractVector)::AbstractVector
33 N = closureSize(L.op)
34 M = length(v)
32 35
36 for i ∈ 1:N
37 u[i] = apply(L.op.closureStencils[i], v, i)
38 end
39
40 for i ∈ N+1:M-N
41 u[i] = apply(L.op.innerStencil, i);
42 end
43
44 for i ∈ M:-1:M-N+1
45 u[i] = apply(flip(L.op.closureStencils[M-i+1]), v, i)
46 end
33 end 47 end