@@ -76,7 +76,7 @@ import LazyArrays: AbstractCachedMatrix, resizedata!
7676 # Comparison with Lanczos
7777 @test Jchol[1 : 500 ,1 : 500 ] ≈ Jlanc[1 : 500 ,1 : 500 ]
7878 end
79-
79+
8080 @testset " w(x) = (1-x)*exp(x)" begin
8181 P = Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])
8282 x = axes (P,1 )
@@ -89,7 +89,7 @@ import LazyArrays: AbstractCachedMatrix, resizedata!
8989 # Comparison with Lanczos
9090 @test Jchol[1 : 500 ,1 : 500 ] ≈ Jlanc[1 : 500 ,1 : 500 ]
9191 end
92-
92+
9393 @testset " w(x) = (1-x^2)*exp(x^2)" begin
9494 P = Normalized (legendre (0 .. 1 ))
9595 x = axes (P,1 )
@@ -102,7 +102,7 @@ import LazyArrays: AbstractCachedMatrix, resizedata!
102102 # Comparison with Lanczos
103103 @test Jchol[1 : 500 ,1 : 500 ] ≈ Jlanc[1 : 500 ,1 : 500 ]
104104 end
105-
105+
106106 @testset " w(x) = x*(1-x^2)*exp(-x^2)" begin
107107 P = Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])
108108 x = axes (P,1 )
@@ -227,7 +227,7 @@ import LazyArrays: AbstractCachedMatrix, resizedata!
227227 @test Q ≠ P
228228 @test Q == Q̃
229229 @test Q̃ == Q
230-
230+
231231 @test Q[0.1 ,1 ] ≈ _p0 (Q) ≈ 1 / sqrt (2 )
232232 @test Q[0.1 ,1 : 10 ] ≈ Q̃[0.1 ,1 : 10 ]
233233 @test Q[0.1 ,10_000 ] ≈ Q̃[0.1 ,10_000 ]
@@ -247,11 +247,20 @@ import LazyArrays: AbstractCachedMatrix, resizedata!
247247 U = ChebyshevU ()
248248 Q = orthogonalpolynomial (x -> (1 + x^ 2 )* sqrt (1 - x^ 2 ), U)
249249 x = axes (U,1 )
250-
250+
251251 @test Q[0.1 ,1 ] ≈ _p0 (Q) ≈ 1 / sqrt (sum (expand (Weighted (U),x -> (1 + x^ 2 )* sqrt (1 - x^ 2 ))))
252252 @test bandwidths (Q\ U) == (0 ,2 )
253253
254254 Q̃ = OrthogonalPolynomial (x -> (1 + x^ 2 )* sqrt (1 - x^ 2 ), U)
255255 @test jacobimatrix (Q)[1 : 10 ,1 : 10 ] == jacobimatrix (Q̃)[1 : 10 ,1 : 10 ]
256256 end
257+
258+ @testset " diff" begin
259+ P = Legendre ()
260+ x = axes (P,1 )
261+ Q = OrthogonalPolynomial (1 .- x)
262+ Q̃ = Normalized (Jacobi (1 ,0 ))
263+ @test_skip diff (Q)[0.1 ,1 : 5 ] ≈ diff (Q̃)[0.1 ,1 : 5 ] # broken due to lazy array issues
264+ @test [diff (Q)[0.1 ,k] for k= 1 : 5 ] ≈ diff (Q̃)[0.1 ,1 : 5 ]
265+ end
257266end
0 commit comments