@@ -136,14 +136,14 @@ The quasi-matrix representing Jacobi polynomials, where the first axes represent
136
136
The eltype, when not specified, will be converted to a floating point data type.
137
137
# Examples
138
138
```jldoctest
139
- julia> J=Jacobi(0,0) # The eltype will be converted to float
140
- Jacobi(0.0, 0. 0)
139
+ julia> J=Jacobi(0, 0) # The eltype will be converted to float
140
+ Jacobi(0, 0)
141
141
142
142
julia> axes(J)
143
143
(Inclusion(-1.0 .. 1.0 (Chebyshev)), OneToInf())
144
144
145
145
julia> J[0,:] # Values of polynomials at x=0
146
- ℵ₀-element view(::Jacobi{Float64}, 0.0, :) with eltype Float64 with indices OneToInf():
146
+ ℵ₀-element view(::Jacobi{Float64, $Int }, 0.0, :) with eltype Float64 with indices OneToInf():
147
147
1.0
148
148
0.0
149
149
-0.5
@@ -162,12 +162,14 @@ julia> J0[0],J0[0.5]
162
162
(1.0, 1.0)
163
163
```
164
164
"""
165
- struct Jacobi{T} <: AbstractJacobi{T}
166
- a:: T
167
- b:: T
168
- Jacobi {T} (a, b) where T = new {T} (convert (T ,a), convert (T ,b))
165
+ struct Jacobi{T,V } <: AbstractJacobi{T}
166
+ a:: V
167
+ b:: V
168
+ Jacobi {T,V } (a, b) where {T,V} = new {T,V } (convert (V ,a), convert (V ,b))
169
169
end
170
170
171
+ Jacobi {T} (a:: V , b:: V ) where {T,V} = Jacobi {T,V} (a, b)
172
+ Jacobi {T} (a, b) where T = Jacobi {T} (promote (a,b)... )
171
173
Jacobi (a:: V , b:: T ) where {T,V} = Jacobi {float(promote_type(T,V))} (a, b)
172
174
173
175
AbstractQuasiArray {T} (w:: Jacobi ) where T = Jacobi {T} (w. a, w. b)
@@ -181,13 +183,13 @@ The [`Jacobi`](@ref) polynomials affine-mapped to interval `d`.
181
183
# Examples
182
184
```jldoctest
183
185
julia> J = jacobi(1, 1, 0..1)
184
- Jacobi(1.0 , 1.0 ) affine mapped to 0 .. 1
186
+ Jacobi(1, 1) affine mapped to 0 .. 1
185
187
186
188
julia> axes(J)
187
189
(Inclusion(0 .. 1), OneToInf())
188
190
189
191
julia> J[0,:]
190
- ℵ₀-element view(::Jacobi{Float64}, -1.0, :) with eltype Float64 with indices OneToInf():
192
+ ℵ₀-element view(::Jacobi{Float64, $Int }, -1.0, :) with eltype Float64 with indices OneToInf():
191
193
1.0
192
194
-2.0
193
195
3.0
@@ -215,8 +217,8 @@ basis_singularities(w::JacobiWeight) = Weighted(Jacobi(w.a, w.b))
215
217
computes the `n`-th Jacobi polynomial, orthogonal with
216
218
respec to `(1-x)^a*(1+x)^b`, at `z`.
217
219
"""
218
- jacobip (n:: Integer , a, b, z) = Base. unsafe_getindex (Jacobi {promote_type (typeof(a), typeof(b), typeof(z))} (a,b), z, n+ 1 )
219
- normalizedjacobip (n:: Integer , a, b, z) = Base. unsafe_getindex (Normalized (Jacobi {promote_type (typeof(a), typeof(b), typeof(z))} (a,b)), z, n+ 1 )
220
+ jacobip (n:: Integer , a, b, z) = Base. unsafe_getindex (Jacobi {polynomialtype (typeof(a), typeof(b), typeof(z))} (a,b), z, n+ 1 )
221
+ normalizedjacobip (n:: Integer , a, b, z) = Base. unsafe_getindex (Normalized (Jacobi {polynomialtype (typeof(a), typeof(b), typeof(z))} (a,b)), z, n+ 1 )
220
222
221
223
OrthogonalPolynomial (w:: JacobiWeight ) = Jacobi (w. a, w. b)
222
224
orthogonalityweight (P:: Jacobi ) = JacobiWeight (P. a, P. b)
@@ -273,15 +275,16 @@ axes(::AbstractJacobi{T}) where T = (Inclusion{T}(ChebyshevInterval{real(T)}()),
273
275
== (P:: Legendre , Q:: Jacobi ) = Jacobi (P) == Q
274
276
== (P:: Jacobi , Q:: Legendre ) = P == Jacobi (Q)
275
277
== (A:: WeightedJacobi , B:: WeightedJacobi ) = A. args == B. args
276
- == (A:: WeightedJacobi , B:: Jacobi{T} ) where T = A == JacobiWeight (zero (T ),zero (T )).* B
278
+ == (A:: WeightedJacobi , B:: Jacobi{T,V } ) where {T,V} = A == JacobiWeight (zero (V ),zero (V )).* B
277
279
== (A:: WeightedJacobi , B:: Legendre ) = A == Jacobi (B)
278
280
== (A:: Legendre , B:: WeightedJacobi ) = Jacobi (A) == B
279
- == (A:: Jacobi{T} , B:: WeightedJacobi ) where T = JacobiWeight (zero (T ),zero (T )).* A == B
281
+ == (A:: Jacobi{T,V } , B:: WeightedJacobi ) where {T,V} = JacobiWeight (zero (V ),zero (V )).* A == B
280
282
== (A:: Legendre , B:: Weighted{<:Any,<:AbstractJacobi} ) = A == B. P
281
283
== (A:: Weighted{<:Any,<:AbstractJacobi} , B:: Legendre ) = A. P == B
282
284
283
285
show (io:: IO , P:: Jacobi ) = summary (io, P)
284
- summary (io:: IO , P:: Jacobi ) = print (io, " Jacobi($(P. a) , $(P. b) )" )
286
+ summary (io:: IO , P:: Jacobi{Float64} ) = print (io, " Jacobi($(P. a) , $(P. b) )" )
287
+ summary (io:: IO , P:: Jacobi{T} ) where T = print (io, " Jacobi{$T }($(P. a) , $(P. b) )" )
285
288
286
289
# ##
287
290
# transforms
@@ -523,22 +526,22 @@ diff(S::Jacobi; dims=1) = ApplyQuasiMatrix(*, Jacobi(S.a+1,S.b+1), _BandedMatrix
523
526
524
527
function diff (S:: Jacobi{T} , m:: Integer ; dims= 1 ) where T
525
528
D = _BandedMatrix ((pochhammer .((S. a + S. b+ 1 ): ∞, m)/ convert (T, 2 )^ m)' , ℵ₀, - m, m)
526
- ApplyQuasiMatrix (* , Jacobi (S. a+ m,S. b+ m), D)
529
+ ApplyQuasiMatrix (* , Jacobi {T} (S. a+ m,S. b+ m), D)
527
530
end
528
531
529
532
530
533
# L_6^t
531
- function diff (WS:: HalfWeighted{:a,<:Any ,<:Jacobi} ; dims= 1 )
534
+ function diff (WS:: HalfWeighted{:a,T ,<:Jacobi} ; dims= 1 ) where T
532
535
S = WS. P
533
536
a,b = S. a, S. b
534
- ApplyQuasiMatrix (* , HalfWeighted {:a} (Jacobi (a- 1 ,b+ 1 )), Diagonal (- (a: ∞)))
537
+ ApplyQuasiMatrix (* , HalfWeighted {:a} (Jacobi {T} (a- 1 ,b+ 1 )), Diagonal (- (a: ∞)))
535
538
end
536
539
537
540
# L_6
538
- function diff (WS:: HalfWeighted{:b,<:Any ,<:Jacobi} ; dims= 1 )
541
+ function diff (WS:: HalfWeighted{:b,T ,<:Jacobi} ; dims= 1 ) where T
539
542
S = WS. P
540
543
a,b = S. a, S. b
541
- ApplyQuasiMatrix (* , HalfWeighted {:b} (Jacobi (a+ 1 ,b- 1 )), Diagonal (b: ∞))
544
+ ApplyQuasiMatrix (* , HalfWeighted {:b} (Jacobi {T} (a+ 1 ,b- 1 )), Diagonal (b: ∞))
542
545
end
543
546
544
547
for ab in (:(:a ), :(:b ))
@@ -549,7 +552,7 @@ for ab in (:(:a), :(:b))
549
552
end
550
553
551
554
552
- function diff (WS:: Weighted{<:Any ,<:Jacobi} ; dims= 1 )
555
+ function diff (WS:: Weighted{T ,<:Jacobi} ; dims= 1 ) where T
553
556
# L_1^t
554
557
S = WS. P
555
558
a,b = S. a, S. b
@@ -560,13 +563,13 @@ function diff(WS::Weighted{<:Any,<:Jacobi}; dims=1)
560
563
elseif iszero (b)
561
564
diff (HalfWeighted {:a} (S))
562
565
else
563
- ApplyQuasiMatrix (* , Weighted (Jacobi (a- 1 , b- 1 )), _BandedMatrix ((- 2 * (1 : ∞))' , ℵ₀, 1 ,- 1 ))
566
+ ApplyQuasiMatrix (* , Weighted (Jacobi {T} (a- 1 , b- 1 )), _BandedMatrix ((- 2 * (1 : ∞))' , ℵ₀, 1 ,- 1 ))
564
567
end
565
568
end
566
569
567
570
568
571
# Jacobi(a-1,b-1)\ (D*w*Jacobi(a,b))
569
- function diff (WS:: WeightedJacobi ; dims= 1 )
572
+ function diff (WS:: WeightedJacobi{T} ; dims= 1 ) where T
570
573
w,S = WS. args
571
574
a,b = S. a, S. b
572
575
if isorthogonalityweighted (WS) # L_1^t
@@ -582,22 +585,22 @@ function diff(WS::WeightedJacobi; dims=1)
582
585
# D * ((1+x)^w.b * P^(a,b)) == D * ((1+x)^(w.b-b) * (1+x)^b * P^(a,b))
583
586
# == (1+x)^(w.b-1) * (w.b-b) * P^(a,b) + (1+x)^(w.b-b) * D*((1+x)^b*P^(a,b))
584
587
# == (1+x)^(w.b-1) * P^(a+1,b) ((w.b-b) * C2 + C1 * W)
585
- W = HalfWeighted {:b} (Jacobi (a+ 1 , b- 1 )) \ diff (HalfWeighted {:b} (S))
586
- J = Jacobi (a+ 1 ,b) # range Jacobi
587
- C1 = J \ Jacobi (a+ 1 , b- 1 )
588
- C2 = J \ Jacobi (a,b)
588
+ W = HalfWeighted {:b} (Jacobi {T} (a+ 1 , b- 1 )) \ diff (HalfWeighted {:b} (S))
589
+ J = Jacobi {T} (a+ 1 ,b) # range Jacobi
590
+ C1 = J \ Jacobi {T} (a+ 1 , b- 1 )
591
+ C2 = J \ Jacobi {T} (a,b)
589
592
ApplyQuasiMatrix (* , JacobiWeight (w. a,w. b- 1 ) .* J, (w. b- b) * C2 + C1 * W)
590
593
elseif iszero (w. b)
591
- W = HalfWeighted {:a} (Jacobi (a- 1 , b+ 1 )) \ diff (HalfWeighted {:a} (S))
592
- J = Jacobi (a,b+ 1 ) # range Jacobi
593
- C1 = J \ Jacobi (a- 1 , b+ 1 )
594
- C2 = J \ Jacobi (a,b)
594
+ W = HalfWeighted {:a} (Jacobi {T} (a- 1 , b+ 1 )) \ diff (HalfWeighted {:a} (S))
595
+ J = Jacobi {T} (a,b+ 1 ) # range Jacobi
596
+ C1 = J \ Jacobi {T} (a- 1 , b+ 1 )
597
+ C2 = J \ Jacobi {T} (a,b)
595
598
ApplyQuasiMatrix (* , JacobiWeight (w. a- 1 ,w. b) .* J, - (w. a- a) * C2 + C1 * W)
596
599
elseif iszero (a) && iszero (b) # Legendre
597
600
# D * ((1+x)^w.b * (1-x)^w.a * P))
598
601
# == (1+x)^(w.b-1) * (1-x)^(w.a-1) * ((1-x) * (w.b) * P - (1+x) * w.a * P + (1-x^2) * D * P)
599
602
# == (1+x)^(w.b-1) * (1-x)^(w.a-1) * ((1-x) * (w.b) * P - (1+x) * w.a * P + P * L * W)
600
- J = Jacobi (a+ 1 ,b+ 1 ) # range space
603
+ J = Jacobi {T} (a+ 1 ,b+ 1 ) # range space
601
604
W = J \ diff (S)
602
605
X = jacobimatrix (S)
603
606
L = S \ Weighted (J)
@@ -608,9 +611,9 @@ function diff(WS::WeightedJacobi; dims=1)
608
611
# == (1+x)^(w.b-1) * (1-x)^(w.a-1) * ((1-x) * (w.b-b) * P^(a,b) + (1+x) * (a-w.a) * P^(a,b))
609
612
# + (1+x)^(w.b-b) * (1-x)^(w.a-a) * D * ((1+x)^b * (1-x)^a * P^(a,b)))
610
613
611
- W = Weighted (Jacobi (a- 1 ,b- 1 )) \ diff (Weighted (S))
614
+ W = Weighted (Jacobi {T} (a- 1 ,b- 1 )) \ diff (Weighted (S))
612
615
X = jacobimatrix (S)
613
- C = S \ Jacobi (a- 1 ,b- 1 )
616
+ C = S \ Jacobi {T} (a- 1 ,b- 1 )
614
617
(JacobiWeight (w. a- 1 ,w. b- 1 ) .* S) * (((w. b- b+ a- w. a)* I+ (a- w. a- w. b+ b) * X) + C* W)
615
618
end
616
619
end
0 commit comments