108
108
end
109
109
end
110
110
111
- @testset " Comparison with Lanczos and Classical, with Clenshaw, basics " begin
111
+ @testset " Comparison with Lanczos and Classical, with Clenshaw, polynomial weights " begin
112
112
@testset " w(x) = x^2*(1-x)" begin
113
113
P = Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])
114
114
x = axes (P,1 )
173
173
# Comparison with Lanczos
174
174
@test Jchol[1 : 500 ,1 : 500 ] ≈ Jlanc[1 : 500 ,1 : 500 ]
175
175
end
176
+ end
177
+
178
+ @testset " Comparison with Lanczos and Classical, with Clenshaw, exponential weights" begin
179
+ @testset " w(x) = exp(x)" begin
180
+ P = Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])
181
+ x = axes (P,1 )
182
+ J = jacobimatrix (P)
183
+ Jx = symmjacobim (J)
184
+ wf (x) = exp (x)
185
+ # compute Jacobi matrix via cholesky
186
+ W = P \ (wf .(x) .* P)
187
+ Jchol = cholesky_jacobimatrix (Symmetric (W))
188
+ # compute Jacobi matrix via Lanczos
189
+ Jlanc = jacobimatrix (LanczosPolynomial (@. (wf .(x)),Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])))
190
+ # Comparison with Lanczos
191
+ @test Jchol[1 : 500 ,1 : 500 ] ≈ Jlanc[1 : 500 ,1 : 500 ]
192
+ end
193
+
194
+ @testset " w(x) = (1-x)*exp(x)" begin
195
+ P = Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])
196
+ x = axes (P,1 )
197
+ J = jacobimatrix (P)
198
+ Jx = symmjacobim (J)
199
+ wf (x) = (1 - x)* exp (x)
200
+ # compute Jacobi matrix via cholesky
201
+ W = P \ (wf .(x) .* P)
202
+ Jchol = cholesky_jacobimatrix (Symmetric (W))
203
+ # compute Jacobi matrix via Lanczos
204
+ Jlanc = jacobimatrix (LanczosPolynomial (@. (wf .(x)),Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])))
205
+ # Comparison with Lanczos
206
+ @test Jchol[1 : 500 ,1 : 500 ] ≈ Jlanc[1 : 500 ,1 : 500 ]
207
+ end
208
+
209
+ @testset " w(x) = (1-x^2)*exp(x^2)" begin
210
+ P = Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])
211
+ x = axes (P,1 )
212
+ J = jacobimatrix (P)
213
+ Jx = symmjacobim (J)
214
+ wf (x) = (1 - x^ 2 )* exp (x^ 2 )
215
+ # compute Jacobi matrix via cholesky
216
+ W = P \ (wf .(x) .* P)
217
+ Jchol = cholesky_jacobimatrix (Symmetric (W))
218
+ # compute Jacobi matrix via Lanczos
219
+ Jlanc = jacobimatrix (LanczosPolynomial (@. (wf .(x)),Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])))
220
+ # Comparison with Lanczos
221
+ @test Jchol[1 : 500 ,1 : 500 ] ≈ Jlanc[1 : 500 ,1 : 500 ]
222
+ end
223
+
224
+ @testset " w(x) = x*(1-x^2)*exp(-x^2)" begin
225
+ P = Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])
226
+ x = axes (P,1 )
227
+ J = jacobimatrix (P)
228
+ Jx = symmjacobim (J)
229
+ wf (x) = x* (1 - x^ 2 )* exp (- x^ 2 )
230
+ # compute Jacobi matrix via cholesky
231
+ W = P \ (wf .(x) .* P)
232
+ Jchol = cholesky_jacobimatrix (Symmetric (W))
233
+ # compute Jacobi matrix via Lanczos
234
+ Jlanc = jacobimatrix (LanczosPolynomial (@. (wf .(x)),Normalized (Legendre ()[affine (0 .. 1 ,Inclusion (- 1 .. 1 )),:])))
235
+ # Comparison with Lanczos
236
+ @test Jchol[1 : 500 ,1 : 500 ] ≈ Jlanc[1 : 500 ,1 : 500 ]
237
+ end
176
238
end
0 commit comments