Skip to content

Commit 1327707

Browse files
authored
Generalise diff to work for ConvertedOrthogonalPolynomial (#228)
* Generalise diff to work for ConvertedOrthogonalPolynomial * Update test_choleskyQR.jl
1 parent 83dac49 commit 1327707

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClassicalOrthogonalPolynomials"
22
uuid = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.14.3"
4+
version = "0.14.4"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/normalized.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,4 @@ basismap(W::Weighted) = basismap(W.P)
301301
const MappedOPLayouts = Union{MappedOPLayout,WeightedOPLayout{MappedOPLayout}}
302302
diff_layout(::MappedOPLayouts, A, dims...) = diff_layout(MappedBasisLayout(), A, dims...)
303303

304-
diff_layout(::NormalizedOPLayout, A, dims...) = diff_layout(ApplyLayout{typeof(*)}(), A, dims...)
304+
diff_layout(::AbstractNormalizedOPLayout, A, dims...) = diff_layout(ApplyLayout{typeof(*)}(), A, dims...)

test/test_choleskyQR.jl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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 ==
229229
@test== 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
= 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+
= 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
257266
end

0 commit comments

Comments
 (0)