Skip to content

Commit 54c1c12

Browse files
authored
add weaklaplacian (#165)
* add weaklaplacian * add test
1 parent 79d4937 commit 54c1c12

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ContinuumArrays"
22
uuid = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
3-
version = "0.16.2"
3+
version = "0.16.3"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/bases/bases.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,13 +637,18 @@ end
637637
grammatrix(A) = grammatrix_layout(MemoryLayout(A), A)
638638
grammatrix_layout(_, A) = error("Not implemented")
639639

640+
640641
function grammatrix_layout(::MappedBasisLayouts, P)
641642
Q = demap(P)
642643
kr = basismap(P)
643644
@assert kr isa AbstractAffineQuasiVector
644645
grammatrix(Q)/kr.A
645646
end
646647

648+
weaklaplacian(A) = weaklaplacian_layout(MemoryLayout(A), A)
649+
weaklaplacian_layout(_, A) = weaklaplacian_axis(axes(A,1), A)
650+
weaklaplacian_axis(::Inclusion{<:Number}, A) = -(diff(A)'diff(A))
651+
647652
function copy(M::Mul{<:AdjointMappedBasisLayouts, <:MappedBasisLayouts})
648653
A = M.A'
649654
kr = basismap(A)

test/test_splines.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ContinuumArrays, LinearAlgebra, Base64, FillArrays, QuasiArrays, BandedMatrices, Test
22
using QuasiArrays: ApplyQuasiArray, ApplyStyle, MemoryLayout, mul, MulQuasiMatrix, Vec
33
import LazyArrays: MulStyle, LdivStyle, arguments, applied, apply
4-
import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout, SubBasisLayout, AdjointMappedBasisLayouts, MappedBasisLayout, plan_grid_transform
4+
import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout, SubBasisLayout, AdjointMappedBasisLayouts, MappedBasisLayout, plan_grid_transform, weaklaplacian
55

66
@testset "Splines" begin
77
@testset "HeavisideSpline" begin
@@ -241,6 +241,8 @@ import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout,
241241
@test A isa BandedMatrix
242242
@test A == (D*L)'*(D*L) == [1.0 -1 0; -1.0 2.0 -1.0; 0.0 -1.0 1.0]
243243
@test bandwidths(A) == (1,1)
244+
245+
@test weaklaplacian(L) == -A
244246
end
245247

246248
@testset "Views" begin

0 commit comments

Comments
 (0)