Skip to content

Commit 7221d48

Browse files
committed
big steps towards generic OP basis
1 parent a69f843 commit 7221d48

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
2222
LazyBandedMatrices = "d7e5e226-e90b-4449-9968-0f923699bf6f"
2323
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2424
QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
25+
SemiclassicalOrthogonalPolynomials = "291c01f3-23f6-4eb6-aeb0-063a639b53f2"
2526
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2627

2728
[compat]

src/decompOPs.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
# This currently takes the weight multiplication operator as input.
22
# I will probably change this to take the weight function instead.
3-
function cholesky_jacobimatrix(W::Symmetric)
4-
bands = CholeskyJacobiBands(W) # the cached array only needs to store two bands bc of symmetry
3+
function cholesky_jacobimatrix(w, P::OrthogonalPolynomial)
4+
W = Symmetric(P \ (w.(axes(P,1)) .* P)) # Compute weight multiplication via Clenshaw
5+
bands = CholeskyJacobiBands(W, P) # the cached array only needs to store two bands bc of symmetry
56
return SymTridiagonal(bands[1,:],bands[2,:])
67
end
78

89
# The generated Jacobi operators are symmetric tridiagonal, so we store their data as two bands
910
mutable struct CholeskyJacobiBands{T} <: AbstractCachedMatrix{T}
1011
data::Matrix{T}
1112
U::UpperTriangular
12-
X::Symmetric{T}
13+
X::SymTridiagonal{T}
1314
datasize::Int
1415
array
1516
end
1617

17-
# SymTridiagonal currently doesn't parse as Symmetric, so here's a Q&D workaround for conversion
18-
symmjacobim(J::SymTridiagonal) = Symmetric(BandedMatrix(0=>J.dv, 1=>J.ev))
19-
2018
# Computes the initial data for the Jacobi operator bands
21-
function CholeskyJacobiBands(W::Symmetric{T}) where T
19+
function CholeskyJacobiBands(W::Symmetric{T}, P::OrthogonalPolynomial) where T
20+
@assert P isa Normalized
2221
U = cholesky(W).U
23-
X = symmjacobim(jacobimatrix(Normalized(Legendre()[affine(zero(T)..one(T),Inclusion(-one(T)..one(T))),:])))
22+
X = jacobimatrix(P)
2423
dat = zeros(T,2,10)
2524
for k in 1:10
2625
dat[1,k] = (U * (X * (U \ [zeros(k-1); 1; zeros(∞)])))[k]

0 commit comments

Comments
 (0)