Skip to content

Commit 1addb1f

Browse files
committed
recurrencecoefficients now defaults to using jacobimatrix
1 parent 3baae8b commit 1addb1f

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
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.3.3"
4+
version = "0.3.4"
55

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

src/ClassicalOrthogonalPolynomials.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ The relationship with the Jacobi matrix is:
144144
C[n+1]/A[n+1] == X[n,n+1]
145145
```
146146
"""
147-
recurrencecoefficients(P) = error("Override for $(typeof(P))")
147+
function recurrencecoefficients(Q::AbstractQuasiMatrix{T}) where T
148+
X = jacobimatrix(Q)
149+
c,a,b = subdiagonaldata(X), diagonaldata(X), supdiagonaldata(X)
150+
inv.(c), -(a ./ c), Vcat(zero(T), b) ./ c
151+
end
148152

149153

150154
const WeightedOrthogonalPolynomial{T, A<:AbstractQuasiVector, B<:OrthogonalPolynomial} = WeightedBasis{T, A, B}

src/lanczos.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ axes(Q::LanczosPolynomial) = (axes(Q.w,1),OneToInf())
183183
_p0(Q::LanczosPolynomial) = inv(Q.data.γ[1])*_p0(Q.P)
184184

185185
jacobimatrix(Q::LanczosPolynomial) = SymTridiagonal(LanczosJacobiBand(Q.data, :d), LanczosJacobiBand(Q.data, :du))
186-
recurrencecoefficients(Q::LanczosPolynomial) = normalized_recurrencecoefficients(Q)
187186

188187
Base.summary(io::IO, Q::LanczosPolynomial{T}) where T = print(io, "LanczosPolynomial{$T} with weight with singularities $(singularities(Q.w))")
189188
Base.show(io::IO, Q::LanczosPolynomial{T}) where T = summary(io, Q)

src/normalized.jl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ axes(Q::Normalized) = axes(Q.P)
5555

5656
_p0(Q::Normalized) = Q.scaling[1]
5757

58-
# p_{n+1} = (A_n * x + B_n) * p_n - C_n * p_{n-1}
59-
# q_{n+1}/h[n+1] = (A_n * x + B_n) * q_n/h[n] - C_n * p_{n-1}/h[n-1]
60-
# q_{n+1} = (h[n+1]/h[n] * A_n * x + h[n+1]/h[n] * B_n) * q_n - h[n+1]/h[n-1] * C_n * p_{n-1}
61-
62-
function normalized_recurrencecoefficients(Q::AbstractQuasiMatrix{T}) where T
63-
X = jacobimatrix(Q)
64-
a,b = diagonaldata(X), supdiagonaldata(X)
65-
inv.(b), -(a ./ b), Vcat(zero(T), b) ./ b
66-
end
67-
68-
recurrencecoefficients(Q::Normalized{T}) where T = normalized_recurrencecoefficients(Q)
6958

7059
# x * p[n] = c[n-1] * p[n-1] + a[n] * p[n] + b[n] * p[n+1]
7160
# x * q[n]/h[n] = c[n-1] * q[n-1]/h[n-1] + a[n] * q[n]/h[n] + b[n] * q[n+1]/h[n+1]

0 commit comments

Comments
 (0)