Skip to content

add weaklaplacian #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ContinuumArrays"
uuid = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
version = "0.16.2"
version = "0.16.3"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
5 changes: 5 additions & 0 deletions src/bases/bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -637,13 +637,18 @@ end
grammatrix(A) = grammatrix_layout(MemoryLayout(A), A)
grammatrix_layout(_, A) = error("Not implemented")


function grammatrix_layout(::MappedBasisLayouts, P)
Q = demap(P)
kr = basismap(P)
@assert kr isa AbstractAffineQuasiVector
grammatrix(Q)/kr.A
end

weaklaplacian(A) = weaklaplacian_layout(MemoryLayout(A), A)
weaklaplacian_layout(_, A) = weaklaplacian_axis(axes(A,1), A)
weaklaplacian_axis(::Inclusion{<:Number}, A) = -(diff(A)'diff(A))

function copy(M::Mul{<:AdjointMappedBasisLayouts, <:MappedBasisLayouts})
A = M.A'
kr = basismap(A)
Expand Down
4 changes: 3 additions & 1 deletion test/test_splines.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ContinuumArrays, LinearAlgebra, Base64, FillArrays, QuasiArrays, BandedMatrices, Test
using QuasiArrays: ApplyQuasiArray, ApplyStyle, MemoryLayout, mul, MulQuasiMatrix, Vec
import LazyArrays: MulStyle, LdivStyle, arguments, applied, apply
import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout, SubBasisLayout, AdjointMappedBasisLayouts, MappedBasisLayout, plan_grid_transform
import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout, SubBasisLayout, AdjointMappedBasisLayouts, MappedBasisLayout, plan_grid_transform, weaklaplacian

@testset "Splines" begin
@testset "HeavisideSpline" begin
Expand Down Expand Up @@ -241,6 +241,8 @@ import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout,
@test A isa BandedMatrix
@test A == (D*L)'*(D*L) == [1.0 -1 0; -1.0 2.0 -1.0; 0.0 -1.0 1.0]
@test bandwidths(A) == (1,1)

@test weaklaplacian(L) == -A
end

@testset "Views" begin
Expand Down