|
1 | 1 | using ContinuumArrays, LinearAlgebra, Base64, FillArrays, QuasiArrays, BandedMatrices, BlockArrays, Test
|
2 | 2 | using QuasiArrays: ApplyQuasiArray, ApplyStyle, MemoryLayout, mul, MulQuasiMatrix, Vec
|
3 |
| -import LazyArrays: MulStyle, LdivStyle, arguments, applied, apply |
| 3 | +import LazyArrays: MulStyle, LdivStyle, arguments, applied, apply, simplifiable |
4 | 4 | import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout, SubBasisLayout, AdjointMappedBasisLayouts, MappedBasisLayout, plan_grid_transform, weaklaplacian
|
5 | 5 |
|
6 | 6 | @testset "Splines" begin
|
@@ -165,10 +165,27 @@ import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout,
|
165 | 165 | @test typeof(diff(L)) == typeof(diff(L; dims=1)) == typeof(D*L)
|
166 | 166 | @test_throws ErrorException diff(L; dims=2)
|
167 | 167 |
|
| 168 | + @test diff(L[:,1:2])[1.1,:] == diff(L)[1.1,1:2] |
| 169 | + |
168 | 170 | @test diff(L,0) ≡ L
|
169 | 171 | @test diff(f,0) ≡ f
|
170 |
| - @test diff(L,2)[1.1,:] == laplacian(L)[1.1,:] == -abslaplacian(L)[1.1,:] |
171 |
| - @test diff(f,2)[1.1] == laplacian(f)[1.1] == -abslaplacian(f)[1.1] |
| 172 | + @test diff(L,2)[1.1,:] == laplacian(L)[1.1,:] == -abslaplacian(L)[1.1,:] == laplacian(L,1)[1.1,:] == -abslaplacian(L,1)[1.1,:] |
| 173 | + |
| 174 | + @test diff(L[:,1:2],2)[1.1,:] == diff(L,2)[1.1,1:2] |
| 175 | + @test diff(f,2)[1.1] == laplacian(f)[1.1] == laplacian(f,1)[1.1] == -abslaplacian(f)[1.1] == -abslaplacian(f,1)[1.1] |
| 176 | + |
| 177 | + @test laplacian(L[:,1:2])[1.1,:] == laplacian(L)[1.1,1:2] == -abslaplacian(L[:,1:2])[1.1,:] == -abslaplacian(L)[1.1,1:2] |
| 178 | + |
| 179 | + Δ = Laplacian(L) |
| 180 | + @test (Δ * L)[1.1,:] == -(abs(Δ) * L)[1.1,:] == laplacian(L)[1.1,:] |
| 181 | + @test simplifiable(*, Δ, L) == simplifiable(*, abs(Δ), L) == Val(true) |
| 182 | + @test -abs(Δ) == Δ |
| 183 | + @test -Δ == abs(Δ) |
| 184 | + @test Δ^2 == Δ*Δ |
| 185 | + @test abs(Δ)^2 == abs(Δ^2) == abs(Δ)^2.0 |
| 186 | + @test simplifiable(*, Δ, Δ) == simplifiable(*, abs(Δ), abs(Δ)) == Val(true) |
| 187 | + @test summary(Δ) == "Laplacian(Inclusion(1 .. 3))" |
| 188 | + @test summary(Δ^2) == "Laplacian(Inclusion(1 .. 3), 2)" |
172 | 189 |
|
173 | 190 | M = applied(*, (D*L).args..., [1,2,4])
|
174 | 191 | @test eltype(materialize(M)) == Float64
|
|
0 commit comments