Skip to content

Commit 4f9cde2

Browse files
committed
weights with exponential terms via Clenshaw
1 parent 7d7dcb1 commit 4f9cde2

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

test/test_decompOPs.jl

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ end
108108
end
109109
end
110110

111-
@testset "Comparison with Lanczos and Classical, with Clenshaw, basics" begin
111+
@testset "Comparison with Lanczos and Classical, with Clenshaw, polynomial weights" begin
112112
@testset "w(x) = x^2*(1-x)" begin
113113
P = Normalized(Legendre()[affine(0..1,Inclusion(-1..1)),:])
114114
x = axes(P,1)
@@ -173,4 +173,66 @@ end
173173
# Comparison with Lanczos
174174
@test Jchol[1:500,1:500] Jlanc[1:500,1:500]
175175
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
176238
end

0 commit comments

Comments
 (0)