@@ -26,18 +26,85 @@ axes(::AbstractJacobi) = (ChebyshevInterval(), OneTo(∞))
26
26
materialize (M:: Mul2{<:Any,<:Any,<:QuasiAdjoint{<:Any,<:Legendre},<:Legendre} ) =
27
27
Diagonal (2 ./ (2 (0 : ∞) .+ 1 ))
28
28
29
+ # pinv(Jacobi(b+1,a+1))D*W*Jacobi(a,b)
30
+ function materialize (M:: Mul {<: Tuple ,<: Tuple {<: PInv{<:Any,<:Jacobi} ,
31
+ <: Derivative{<:Any,<:ChebyshevInterval} ,
32
+ <: Jacobi }})
33
+ Ji, D, S = M. factors
34
+ J = parent (Ji)
35
+ (J. b == S. b+ 1 && J. a == S. a+ 1 ) || throw (ArgumentError ())
36
+ _BandedMatrix (((1 : ∞ .+ 1 .+ S. a .+ S. b)/ 2 )' , ∞, - 1 ,1 )
37
+ end
38
+
29
39
30
40
function materialize (M:: Mul2{<:Any,<:Any,<:Derivative{<:Any,<:ChebyshevInterval},<:Jacobi} )
31
- _, S = M. factors
32
- D = _BandedMatrix (((1 : ∞ .+ 1 .+ S. a .+ S. b)/ 2 )' , ∞, - 1 ,1 )
33
- Mul (Jacobi (S. a+ 1 ,S. b+ 1 ), D)
41
+ D, S = M. factors
42
+ A = PInv (Jacobi (S. b+ 1 ,S. a+ 1 ))* D* S
43
+ Mul (Jacobi (S. b+ 1 ,S. a+ 1 ), A)
44
+ end
45
+
46
+ # pinv(Legendre())D*W*Jacobi(true,true)
47
+ function materialize (M:: Mul {<: Tuple ,<: Tuple {<: PInv{<:Any,<:Legendre} ,
48
+ <: Derivative{<:Any,<:ChebyshevInterval} ,
49
+ QuasiDiagonal{Bool,JacobiWeight{Bool}},Jacobi{Bool}}})
50
+ Li, _, W, S = M. factors
51
+ w = parent (W)
52
+ (w. a && S. a && w. b && S. b) || throw (ArgumentError ())
53
+ _BandedMatrix ((- 2 * (1 : ∞))' , ∞, 1 ,- 1 )
34
54
end
35
55
56
+ # reduce to Legendre
36
57
function materialize (M:: Mul {<: Tuple ,<: Tuple {<: Derivative{<:Any,<:ChebyshevInterval} ,
37
58
QuasiDiagonal{Bool,JacobiWeight{Bool}},Jacobi{Bool}}})
38
- _ , W, S = M. factors
59
+ D , W, S = M. factors
39
60
w = parent (W)
40
61
(w. a && S. a && w. b && S. b) || throw (ArgumentError ())
41
- D = _BandedMatrix ((- 2 * (1 : ∞))' , ∞, 1 ,- 1 )
42
- Mul (Legendre (), D)
62
+ A = pinv (Legendre {eltype(M)} ())* D* W* S
63
+ Mul (Legendre (), A)
64
+ end
65
+
66
+ function materialize (M:: Mul {<: Tuple ,<: Tuple {<: PInv{<:Any,<:Jacobi{Bool}} ,
67
+ QuasiDiagonal{Bool,JacobiWeight{Bool}},Jacobi{Bool}}})
68
+ Ji, W, S = M. factors
69
+ J,w = parent (Ji),parent (W)
70
+ @assert S. b && S. a
71
+ if w. b && ! w. a
72
+ @assert ! J. b && J. a
73
+ _BandedMatrix (Vcat (((2 : 2 : ∞). / (3 : 2 : ∞))' ,((2 : 2 : ∞). / (3 : 2 : ∞))' ), ∞, 1 ,0 )
74
+ elseif ! w. b && w. a
75
+ @assert J. b && ! J. a
76
+ _BandedMatrix (Vcat (((2 : 2 : ∞). / (3 : 2 : ∞))' ,(- (2 : 2 : ∞). / (3 : 2 : ∞))' ), ∞, 1 ,0 )
77
+ else
78
+ error (" Not implemented" )
79
+ end
80
+ end
81
+
82
+ function materialize (M:: Mul {<: Tuple ,<: Tuple {<: PInv{<:Any,<:Legendre} ,
83
+ QuasiDiagonal{Bool,JacobiWeight{Bool}},Jacobi{Bool}}})
84
+ Li, W, S = M. factors
85
+ L,w = parent (Li),parent (W)
86
+ if w. b && w. a
87
+ @assert S. b && S. a
88
+ _BandedMatrix (Vcat (((2 : 2 : ∞). / (3 : 2 : ∞))' , Zeros (1 ,∞), (- (2 : 2 : ∞). / (3 : 2 : ∞))' ), ∞, 2 ,0 )
89
+ elseif w. b && ! w. a
90
+ @assert S. b && ! S. a
91
+ _BandedMatrix (Ones {eltype(M)} (2 ,∞), ∞, 1 ,0 )
92
+ elseif ! w. b && w. a
93
+ @assert ! S. b && S. a
94
+ _BandedMatrix (Vcat (Ones {eltype(M)} (1 ,∞),- Ones {eltype(M)} (1 ,∞)), ∞, 1 ,0 )
95
+ else
96
+ error (" Not implemented" )
97
+ end
98
+ end
99
+
100
+ function materialize (M:: Mul {<: Tuple ,<: Tuple {QuasiAdjoint{Bool,Jacobi{Bool}},
101
+ QuasiDiagonal{Int,JacobiWeight{Int}},Jacobi{Bool}}})
102
+ St, W, S = M. factors
103
+
104
+ w = parent (W)
105
+ (w. b == 2 && S. b && w. a == 2 && S. a && parent (St) == S) || throw (ArgumentError ())
106
+ W_sqrt = Diagonal (JacobiWeight (true ,true ))
107
+ L = Legendre ()
108
+ A = PInv (L)* W_sqrt* S
109
+ A' * (L' L)* A
43
110
end
0 commit comments