File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
22
22
LazyBandedMatrices = " d7e5e226-e90b-4449-9968-0f923699bf6f"
23
23
LinearAlgebra = " 37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
24
24
QuasiArrays = " c4ea9172-b204-11e9-377d-29865faadc5c"
25
+ SemiclassicalOrthogonalPolynomials = " 291c01f3-23f6-4eb6-aeb0-063a639b53f2"
25
26
SpecialFunctions = " 276daf66-3868-5448-9aa4-cd146d93841b"
26
27
27
28
[compat ]
Original file line number Diff line number Diff line change 1
1
# This currently takes the weight multiplication operator as input.
2
2
# 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
5
6
return SymTridiagonal (bands[1 ,:],bands[2 ,:])
6
7
end
7
8
8
9
# The generated Jacobi operators are symmetric tridiagonal, so we store their data as two bands
9
10
mutable struct CholeskyJacobiBands{T} <: AbstractCachedMatrix{T}
10
11
data:: Matrix{T}
11
12
U:: UpperTriangular
12
- X:: Symmetric {T}
13
+ X:: SymTridiagonal {T}
13
14
datasize:: Int
14
15
array
15
16
end
16
17
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
-
20
18
# 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
22
21
U = cholesky (W). U
23
- X = symmjacobim ( jacobimatrix (Normalized ( Legendre ()[ affine ( zero (T) .. one (T), Inclusion ( - one (T) .. one (T))),:])) )
22
+ X = jacobimatrix (P )
24
23
dat = zeros (T,2 ,10 )
25
24
for k in 1 : 10
26
25
dat[1 ,k] = (U * (X * (U \ [zeros (k- 1 ); 1 ; zeros (∞)])))[k]
You can’t perform that action at this time.
0 commit comments