Skip to content

Commit dc004e6

Browse files
authored
Avoid ambiguity warning in getindex for LanczosJacobiBand (#15)
* Avoid ambiguity warning in getindex for LanczosJacobiBand * Update test_lanczos.jl
1 parent cd41669 commit dc004e6

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
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.2.0"
4+
version = "0.2.1"
55

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

src/lanczos.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ end
140140

141141
getindex(A::LanczosJacobiBand, I::Integer) = _lanczos_getindex(A, I)
142142
getindex(A::LanczosJacobiBand, I::AbstractVector) = _lanczos_getindex(A, I)
143-
getindex(K::LanczosJacobiBand, k::AbstractInfUnitRange) = view(K, k)
144-
getindex(K::SubArray{<:Any,1,<:LanczosJacobiBand}, k::AbstractInfUnitRange) = view(K, k)
143+
getindex(K::LanczosJacobiBand, k::AbstractInfUnitRange{<:Integer}) = view(K, k)
144+
getindex(K::SubArray{<:Any,1,<:LanczosJacobiBand}, k::AbstractInfUnitRange{<:Integer}) = view(K, k)
145145

146146
copy(A::LanczosJacobiBand) = A # immutable
147147

test/test_lanczos.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ import ClassicalOrthogonalPolynomials: recurrencecoefficients, PaddedLayout
100100
@testset "Singularity" begin
101101
T = Chebyshev(); wT = WeightedChebyshev()
102102
x = axes(T,1)
103-
103+
104104
w = wT * [1; zeros(∞)];
105105
Q = LanczosPolynomial(w)
106106
@test Q[0.1,1:10] Normalized(T)[0.1,1:10]
@@ -134,7 +134,7 @@ import ClassicalOrthogonalPolynomials: recurrencecoefficients, PaddedLayout
134134
@testset "Mixed Jacobi" begin
135135
P = Jacobi(1/2,0)
136136
x = axes(P,1)
137-
137+
138138
w = @. sqrt(1-x)
139139
Q = LanczosPolynomial(w, P)
140140
@test Q[0.1,1:10] Normalized(P)[0.1,1:10]
@@ -199,4 +199,13 @@ import ClassicalOrthogonalPolynomials: recurrencecoefficients, PaddedLayout
199199
R = LanczosPolynomial((t .- x).^(-1/2) .* ChebyshevWeight())
200200
@test R[0.1,2] -0.03269577983003056
201201
end
202+
203+
@testset "LanczosJacobiBand" begin
204+
x = Inclusion(ChebyshevInterval())
205+
Q = LanczosPolynomial( 1 ./ (2 .+ x))
206+
X = jacobimatrix(Q)
207+
@test X.dv[3:10] [X[k,k] for k in 3:10]
208+
@test X.dv[3:∞][1:5] X.dv[3:7]
209+
@test X.dv[3:∞][2:∞][1:5] X.dv[4:8]
210+
end
202211
end

0 commit comments

Comments
 (0)