@@ -73,8 +73,8 @@ function jacobimatrix(P::Ultraspherical{T}) where T
7373end
7474
7575# These return vectors A[k], B[k], C[k] are from DLMF. Cause of MikaelSlevinsky we need an extra entry in C ... for now.
76- function recurrencecoefficients (C:: Ultraspherical )
77- λ = C. λ
76+ function recurrencecoefficients (C:: Ultraspherical{T} ) where T
77+ λ = convert (T, C. λ)
7878 n = 0 : ∞
7979 (2 (n .+ λ) ./ (n .+ 1 ), Zeros {typeof(λ)} (∞), (n .+ (2 λ- 1 )) ./ (n .+ 1 ))
8080end
9191@simplify function * (D:: Derivative{<:Any,<:ChebyshevInterval} , S:: Legendre )
9292 T = promote_type (eltype (D),eltype (S))
9393 A = _BandedMatrix (Ones {T} (1 ,∞), ℵ₀, - 1 ,1 )
94- ApplyQuasiMatrix (* , Ultraspherical {T} (3 / 2 ), A)
94+ ApplyQuasiMatrix (* , Ultraspherical {T} (convert (T, 3 ) / 2 ), A)
9595end
9696
9797
9898# Ultraspherical(λ+1)\(D*Ultraspherical(λ))
9999@simplify function * (D:: Derivative{<:Any,<:ChebyshevInterval} , S:: Ultraspherical )
100- A = _BandedMatrix (Fill (2 S. λ,1 ,∞), ℵ₀, - 1 ,1 )
101- ApplyQuasiMatrix (* , Ultraspherical {eltype(S)} (S. λ+ 1 ), A)
100+ T = promote_type (eltype (D),eltype (S))
101+ A = _BandedMatrix (Fill (2 convert (T,S. λ),1 ,∞), ℵ₀, - 1 ,1 )
102+ ApplyQuasiMatrix (* , Ultraspherical {T} (S. λ+ 1 ), A)
102103end
103104
104105# Ultraspherical(λ-1)\ (D*wUltraspherical(λ))
105106@simplify function * (D:: Derivative{<:Any,<:AbstractInterval} , WS:: Weighted{<:Any,<:Ultraspherical} )
106107 S = WS. P
107108 λ = S. λ
108- T = eltype (WS )
109+ T = promote_type ( eltype (D), eltype (WS) )
109110 if λ == 1
110- A = _BandedMatrix ((- (1 : ∞))' , ℵ₀, 1 ,- 1 )
111- ApplyQuasiMatrix (* , ChebyshevTWeight {T} () .* ChebyshevT {T} (), A)
111+ A = _BandedMatrix ((- (one (T) : ∞))' , ℵ₀, 1 ,- 1 )
112+ ApplyQuasiMatrix (* , Weighted ( ChebyshevT {T} () ), A)
112113 else
113114 n = (0 : ∞)
114115 A = _BandedMatrix ((- one (T)/ (2 * (λ- 1 )) * ((n.+ 1 ) .* (n .+ (2 λ- 1 ))))' , ℵ₀, 1 ,- 1 )
115- ApplyQuasiMatrix (* , WeightedUltraspherical {T} (λ- 1 ), A)
116+ ApplyQuasiMatrix (* , Weighted ( Ultraspherical {T} (λ- 1 ) ), A)
116117 end
117118end
118119
@@ -160,30 +161,32 @@ end
160161\ (T:: Chebyshev , C:: Ultraspherical ) = inv (C \ T)
161162
162163function \ (C2:: Ultraspherical{<:Any,<:Integer} , C1:: Ultraspherical{<:Any,<:Integer} )
163- λ = C1. λ
164164 T = promote_type (eltype (C2), eltype (C1))
165- if C2. λ == λ+ 1
166- _BandedMatrix ( Vcat (- (λ ./ ((0 : ∞) .+ λ))' , Zeros (1 ,∞), (λ ./ ((0 : ∞) .+ λ))' ), ℵ₀, 0 , 2 )
167- elseif C2. λ == λ
165+ λ_Int = C1. λ
166+ λ = convert (T,λ_Int)
167+ if C2. λ == λ_Int+ 1
168+ _BandedMatrix ( Vcat (- (λ ./ ((0 : ∞) .+ λ))' , Zeros {T} (1 ,∞), (λ ./ ((0 : ∞) .+ λ))' ), ℵ₀, 0 , 2 )
169+ elseif C2. λ == λ_Int
168170 Eye {T} (∞)
169- elseif C2. λ > λ
170- (C2 \ Ultraspherical (λ + 1 )) * (Ultraspherical (λ + 1 )\ C1)
171+ elseif C2. λ > λ_Int
172+ (C2 \ Ultraspherical (λ_Int + 1 )) * (Ultraspherical (λ_Int + 1 )\ C1)
171173 else
172174 error (" Not implemented" )
173175 end
174176end
175177
176178function \ (C2:: Ultraspherical , C1:: Ultraspherical )
177- λ = C1. λ
178179 T = promote_type (eltype (C2), eltype (C1))
180+ λ_Int = C1. λ
181+ λ = convert (T,λ_Int)
179182 if C2. λ == λ+ 1
180- _BandedMatrix ( Vcat (- (λ ./ ((0 : ∞) .+ λ))' , Zeros (1 ,∞), (λ ./ ((0 : ∞) .+ λ))' ), ℵ₀, 0 , 2 )
181- elseif C2. λ == λ
183+ _BandedMatrix ( Vcat (- (λ ./ ((0 : ∞) .+ λ))' , Zeros {T} (1 ,∞), (λ ./ ((0 : ∞) .+ λ))' ), ℵ₀, 0 , 2 )
184+ elseif C2. λ == λ_Int
182185 Eye {T} (∞)
183- elseif isinteger (C2. λ- λ ) && C2. λ > λ
184- Cm = Ultraspherical {T} (λ + 1 )
186+ elseif isinteger (C2. λ- λ_Int ) && C2. λ > λ_Int
187+ Cm = Ultraspherical {T} (λ_Int + 1 )
185188 (C2 \ Cm) * (Cm \ C1)
186- elseif isinteger (C2. λ- λ )
189+ elseif isinteger (C2. λ- λ_Int )
187190 inv (C1 \ C2)
188191 else
189192 error (" Not implemented" )
@@ -193,13 +196,14 @@ end
193196function \ (w_A:: WeightedUltraspherical , w_B:: WeightedUltraspherical )
194197 wA,A = w_A. args
195198 wB,B = w_B. args
199+ T = promote_type (eltype (w_A),eltype (w_B))
196200
197201 if wA == wB
198202 A \ B
199203 elseif B. λ == A. λ+ 1 && wB. λ == wA. λ+ 1 # Lower
200- λ = A. λ
204+ λ = convert (T, A. λ)
201205 _BandedMatrix (Vcat (((2 λ:∞ ) .* ((2 λ+ 1 ): ∞) ./ (4 λ .* (λ+ 1 : ∞)))' ,
202- Zeros (1 ,∞),
206+ Zeros {T} (1 ,∞),
203207 (- (1 : ∞) .* (2 : ∞) ./ (4 λ .* (λ+ 1 : ∞)))' ), ℵ₀, 2 ,0 )
204208 else
205209 error (" not implemented for $A and $wB " )
0 commit comments