Skip to content

Commit 3450e6f

Browse files
authored
Support more Lanczos singularitities (#7)
* Support more Lanczos singularitities * v0.1.2
1 parent b012d45 commit 3450e6f

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
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.1.1"
4+
version = "0.1.2"
55

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

src/jacobi.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ for op in (:+, :-, :*)
6868
singularitiesbroadcast(::typeof($op), ::NoSingularities, L::LegendreWeight) = L
6969
end
7070
end
71+
singularitiesbroadcast(::typeof(^), L::LegendreWeight, ::NoSingularities) = L
7172
singularitiesbroadcast(::typeof(/), ::NoSingularities, L::LegendreWeight) = L # can't find roots
7273

7374
_parent(::NoSingularities) = NoSingularities()
@@ -78,8 +79,8 @@ singularitiesbroadcast(F::Function, G::Function, V::SubQuasiArray, K) = singular
7879
singularitiesbroadcast(F, V::Union{NoSingularities,SubQuasiArray}...) = singularitiesbroadcast(F, map(_parent,V)...)[_parentindices(V...)...]
7980

8081

81-
singularitiesbroadcast(::typeof(*), ::LegendreWeight, b::JacobiWeight) = b
82-
singularitiesbroadcast(::typeof(*), a::JacobiWeight, ::LegendreWeight) = a
82+
singularitiesbroadcast(::typeof(*), ::LegendreWeight, b::AbstractJacobiWeight) = b
83+
singularitiesbroadcast(::typeof(*), a::AbstractJacobiWeight, ::LegendreWeight) = a
8384

8485
abstract type AbstractJacobi{T} <: OrthogonalPolynomial{T} end
8586

test/test_lanczos.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,19 @@ import ClassicalOrthogonalPolynomials: recurrencecoefficients, PaddedLayout
183183
@test (pϕ.P' * (ϕw .*.P))[1:3,1:3] [2 -0.5 0; -0.5 2 -0.5; 0 -0.5 2]
184184
@test (pϕ' * (ϕw .* pϕ))[1:5,1:5] I
185185
end
186+
187+
@testset "weighted Chebyshev" begin
188+
T = ChebyshevT()
189+
x = axes(T,1)
190+
t = 2
191+
Q = LanczosPolynomial((t .- x).^(-1) .* ChebyshevWeight())
192+
# perturbation of Toeplitz
193+
@test jacobimatrix(Q)[3:10,3:10] Symmetric(BandedMatrix(1 => Fill(0.5,7)))
194+
195+
Q = LanczosPolynomial((t .- x) .^ (-1))
196+
@test Q[0.1,2] -0.1327124082839674
197+
198+
R = LanczosPolynomial((t .- x).^(-1/2) .* ChebyshevWeight())
199+
@test R[0.1,2] -0.03269577983003056
200+
end
186201
end

0 commit comments

Comments
 (0)