Skip to content

Commit ac9efc2

Browse files
committed
begin tidying
1 parent a300233 commit ac9efc2

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

src/SemiclassicalOrthogonalPolynomials.jl

+3-20
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ function jacobimatrix(P::RaisedOP{T}) where T
101101
Tridiagonal(c, BroadcastVector((ℓ,a,b,v) -> a - b *+ v, ℓ,a,b,v), b)
102102
end
103103

104-
105-
106-
107-
108-
109-
110-
111104
"""
112105
the bands of the Jacobi matrix
113106
"""
@@ -142,7 +135,6 @@ SemiclassicalJacobiBand{dv}(a,b,ℓ) where dv = SemiclassicalJacobiBand{dv,promo
142135
copy(r::SemiclassicalJacobiBand) = r # immutable
143136

144137

145-
146138
"""
147139
SemiclassicalJacobi(t, a, b, c)
148140
@@ -191,24 +183,15 @@ function semiclassical_jacobimatrix(t, a, b, c)
191183
return qr_jacobimatrix(x->(t.-x).^(c÷2), Normalized(jacobi(a,b,UnitInterval{T}())))
192184
elseif isodd(c)
193185
return semiclassical_jacobimatrix(SemiclassicalJacobi(t, a, b, c-1), a, b, c)
194-
else # c is not an even integer, use Lanczos for now
195-
X = jacobimatrix(LanczosPolynomial(@.(x^a * (1-x)^b * (t-x)^c), P))
196-
# todo: workaround for bug which prevents (LanczosJacobiMatrix)^Int from working
197-
return Symmetric(BandedMatrix(0 => X.dv, 1 => X.ev))
186+
else # if c is not an even integer, use Lanczos for now
187+
return jacobimatrix(LanczosPolynomial(@.(x^a * (1-x)^b * (t-x)^c), P))
198188
end
199189
end
200190

201-
# todo: These function overloads are workarounds for the Lanczos bug which prevents (LanczosJacobiMatrix)^Int from working
202-
# todo: Can be removed once that is fixed
203-
diagonaldata(X::BandedMatrix) = view(X,band(0))
204-
subdiagonaldata(X::BandedMatrix) = view(X,band(-1))
205-
supdiagonaldata(X::BandedMatrix) = view(X,band(1))
206-
207191
function symraised_jacobimatrix(Q, y)
208192
= OrthogonalPolynomialRatio(Q,y)
209193
X = jacobimatrix(Q)
210-
# todo: cannot just use diagonaldata due to workaround for bug which prevents (LanczosJacobiMatrix)^Int from working
211-
a,b = view(X,band(0)), view(X,band(1))
194+
a,b = diagonaldata(X), supdiagonaldata(X)
212195
SymTridiagonal(SemiclassicalJacobiBand{:dv}(a,b,ℓ), SemiclassicalJacobiBand{:ev}(a,b,ℓ))
213196
end
214197

src/lowering.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###########
2-
# Generic methods for obtaining Jacobi matrices with one of the a, b and c parameters lowered by 1.
2+
# Generic fallback methods for obtaining Jacobi matrices with one of the a, b and c parameters lowered by 1.
33
# passing symbols :a, :b or :c into lowindex determines which parameter is lowered
44
######
55
function initialα_gen(P::SemiclassicalJacobi, lowindex::Symbol)
@@ -163,8 +163,8 @@ end
163163

164164
###########
165165
# Methods for the special case of computing SemiclassicalJacobi(t,0,0,-1)
166-
######
167166
# As this can be built from SemiclassicalJacobi(t,0,0,0) which is just shifted and normalized Legendre(), we have more explicit methods at our disposal due to explicitly known coefficients for the Legendre bases.
167+
######
168168

169169
###
170170
# α coefficients implementation, cached, direct and via recurrences

0 commit comments

Comments
 (0)