@@ -57,7 +57,8 @@ associated(::ChebyshevT{T}) where T = ChebyshevU{T}()
57
57
associated (:: ChebyshevU{T} ) where T = ChebyshevU {T} ()
58
58
59
59
60
- const StieltjesPoint{T,V,D} = BroadcastQuasiMatrix{T,typeof (inv),Tuple{BroadcastQuasiMatrix{T,typeof (- ),Tuple{T,QuasiAdjoint{V,Inclusion{V,D}}}}}}
60
+ const StieltjesPoint{T,W<: Number ,V,D} = BroadcastQuasiMatrix{T,typeof (inv),Tuple{BroadcastQuasiMatrix{T,typeof (- ),Tuple{W,QuasiAdjoint{V,Inclusion{V,D}}}}}}
61
+ const LogKernelPoint{T<: Real ,C,W<: Number ,V,D} = BroadcastQuasiMatrix{T,typeof (log),Tuple{BroadcastQuasiMatrix{T,typeof (abs),Tuple{BroadcastQuasiMatrix{C,typeof (- ),Tuple{W,QuasiAdjoint{V,Inclusion{V,D}}}}}}}}
61
62
const ConvKernel{T,D1,D2} = BroadcastQuasiMatrix{T,typeof (- ),Tuple{D1,QuasiAdjoint{T,D2}}}
62
63
const Hilbert{T,D1,D2} = BroadcastQuasiMatrix{T,typeof (inv),Tuple{ConvKernel{T,Inclusion{T,D1},Inclusion{T,D2}}}}
63
64
const LogKernel{T,D1,D2} = BroadcastQuasiMatrix{T,typeof (log),Tuple{BroadcastQuasiMatrix{T,typeof (abs),Tuple{ConvKernel{T,Inclusion{T,D1},Inclusion{T,D2}}}}}}
79
80
log .(x .+ one (T)) .- log .(one (T) .- x)
80
81
end
81
82
82
- @simplify function * (H:: Hilbert{<:Any,<:ChebyshevInterval,<:ChebyshevInterval} , wT:: Weighted{<:Any,<:ChebyshevT} )
83
+ @simplify function * (H:: Hilbert{<:Any,<:ChebyshevInterval,<:ChebyshevInterval} , wT:: Weighted{<:Any,<:ChebyshevT} )
83
84
T = promote_type (eltype (H), eltype (wT))
84
85
ChebyshevU {T} () * _BandedMatrix (Fill (- convert (T,π),1 ,∞), ℵ₀, - 1 , 1 )
85
86
end
86
87
87
- @simplify function * (H:: Hilbert{<:Any,<:ChebyshevInterval,<:ChebyshevInterval} , wU:: Weighted{<:Any,<:ChebyshevU} )
88
+ @simplify function * (H:: Hilbert{<:Any,<:ChebyshevInterval,<:ChebyshevInterval} , wU:: Weighted{<:Any,<:ChebyshevU} )
88
89
T = promote_type (eltype (H), eltype (wU))
89
90
ChebyshevT {T} () * _BandedMatrix (Fill (convert (T,π),1 ,∞), ℵ₀, 1 , - 1 )
90
91
end
91
92
92
93
93
- @simplify function * (H:: Hilbert{<:Any,<:ChebyshevInterval,<:ChebyshevInterval} , wP:: Weighted{<:Any,<:OrthogonalPolynomial} )
94
+ @simplify function * (H:: Hilbert{<:Any,<:ChebyshevInterval,<:ChebyshevInterval} , wP:: Weighted{<:Any,<:OrthogonalPolynomial} )
94
95
P = wP. P
95
96
w = orthogonalityweight (P)
96
97
A = recurrencecoefficients (P)[1 ]
@@ -150,11 +151,11 @@ end
150
151
PiecewiseInterlace (c,d) * BlockBroadcastArray {promote_type(eltype(H),eltype(S))} (hvcat, 2 , A, B, C, D)
151
152
end
152
153
153
- # ##
154
+ # ##
154
155
# LogKernel
155
156
# ##
156
157
157
- @simplify function * (L:: LogKernel{<:Any,<:ChebyshevInterval,<:ChebyshevInterval} , wT:: Weighted{<:Any,<:ChebyshevT} )
158
+ @simplify function * (L:: LogKernel{<:Any,<:ChebyshevInterval,<:ChebyshevInterval} , wT:: Weighted{<:Any,<:ChebyshevT} )
158
159
T = promote_type (eltype (L), eltype (wT))
159
160
ChebyshevT {T} () * Diagonal (Vcat (- convert (T,π)* log (2 * one (T)),- convert (T,π)./ (1 : ∞)))
160
161
end
@@ -172,11 +173,11 @@ end
172
173
173
174
174
175
175
- # ##
176
+ # ##
176
177
# PowKernel
177
178
# ##
178
179
179
- @simplify function * (K:: PowKernel , wT:: Weighted{<:Any,<:Jacobi} )
180
+ @simplify function * (K:: PowKernel , wT:: Weighted{<:Any,<:Jacobi} )
180
181
T = promote_type (eltype (K), eltype (wT))
181
182
cnv,α = K. args
182
183
x,y = K. args[1 ]. args[1 ]. args
203
204
P = wP. P
204
205
w = orthogonalityweight (P)
205
206
X = jacobimatrix (P)
206
- z, x = parent (S). args[1 ]. args
207
- z in axes (P,1 ) && transpose ((inv .(x .- x ' ) * wP)[ z,:] )
207
+ z, xc = parent (S). args[1 ]. args
208
+ z in axes (P,1 ) && return transpose (view (inv .(xc ' .- xc ) * wP, z,:) )
208
209
transpose ((X' - z* I) \ [- sum (w)* _p0 (P); zeros (∞)])
209
210
end
210
211
@@ -213,12 +214,35 @@ sqrtx2(x::Real) = sign(x)*sqrt(x^2-1)
213
214
214
215
@simplify function * (S:: StieltjesPoint , wP:: Weighted{<:Any,<:ChebyshevU} )
215
216
T = promote_type (eltype (S), eltype (wP))
216
- z, x = parent (S). args[1 ]. args
217
- z in axes (wP,1 ) && transpose (( inv .(x .- x ' ) * wP )[z,:])
217
+ z, xc = parent (S). args[1 ]. args
218
+ z in axes (wP,1 ) && return ( convert (T,π) * ChebyshevT ( )[z,2 : end ]) '
218
219
ξ = inv (z + sqrtx2 (z))
219
220
transpose (convert (T,π) * ξ.^ oneto (∞))
220
221
end
221
222
223
+ # ###
224
+ # LogKernelPoint
225
+ # ###
226
+
227
+ @simplify function * (L:: LogKernelPoint , wP:: Weighted{<:Any,<:ChebyshevU} )
228
+ T = promote_type (eltype (L), eltype (wP))
229
+ z, xc = parent (L). args[1 ]. args[1 ]. args
230
+ if z in axes (wP,1 )
231
+ Tn = Vcat (convert (T,π)* log (2 * one (T)), convert (T,π)* ChebyshevT ()[z,2 : end ]. / oneto (∞))
232
+ return transpose ((Tn[3 : end ]- Tn[1 : end ])/ 2 )
233
+ else
234
+ # for U_k where k>=1
235
+ ξ = inv (z + sqrtx2 (z))
236
+ ζ = (convert (T,π)* ξ.^ oneto (∞)). / oneto (∞)
237
+ ζ = (ζ[3 : end ]- ζ[1 : end ])/ 2
238
+
239
+ # for U_0
240
+ ζ = Vcat (convert (T,π)* (ξ^ 2 / 4 - (log .(abs .(ξ)) + log (2 * one (T)))/ 2 ), ζ)
241
+ return transpose (ζ)
242
+ end
243
+
244
+ end
245
+
222
246
"""
223
247
HilbertVandermonde(M, data)
224
248
@@ -231,7 +255,7 @@ mutable struct HilbertVandermonde{T,MM} <: AbstractCachedMatrix{T}
231
255
colsupport:: Vector{Int}
232
256
end
233
257
234
- HilbertVandermonde (M, data:: Matrix ) = HilbertVandermonde (M, data, size (data), Int[] )
258
+ HilbertVandermonde (M, data:: Matrix ) = HilbertVandermonde (M, data, size (data), fill ( size (data, 1 ), size (data, 2 )) )
235
259
size (H:: HilbertVandermonde ) = (ℵ₀,ℵ₀)
236
260
function colsupport (H:: HilbertVandermonde , j)
237
261
resizedata! (H, H. datasize[1 ], maximum (j))
@@ -244,7 +268,7 @@ function cache_filldata!(H::HilbertVandermonde{T}, kr, jr) where T
244
268
n,m = H. datasize
245
269
isempty (jr) && return
246
270
resize! (H. colsupport, max (length (H. colsupport), maximum (jr)))
247
-
271
+
248
272
isempty (kr) || (H. data[(n+ 1 ): maximum (kr),1 : m] .= zero (T))
249
273
for j in (m+ 1 ): maximum (jr)
250
274
u = H. M * [H. data[:,j- 1 ]; Zeros {T} (∞)]
256
280
@simplify function * (H:: Hilbert{<:Any,<:Any,<:ChebyshevInterval} , W:: Weighted{<:Any,<:ChebyshevU} )
257
281
x = axes (H,1 )
258
282
T̃ = chebyshevt (x)
259
- ψ_1 = T̃ \ inv .(x .+ sqrtx2 .(x))
283
+ ψ_1 = T̃ \ inv .(x .+ sqrtx2 .(x)) # same ψ_1 = x .- sqrt(x^2 - 1) but with relative accuracy as x -> ∞
260
284
data = convert (eltype (H),π) * Matrix (reshape (paddeddata (ψ_1),:,1 ))
285
+ # Operator has columns π * ψ_1^k
261
286
T̃ * HilbertVandermonde (Clenshaw (T̃ * ψ_1, T̃), data)
262
287
end
263
288
@@ -272,14 +297,14 @@ end
272
297
(inv .(z̃ .- x̃' ) * P)[:,parentindices (wT)[2 ]]
273
298
end
274
299
275
- @simplify function * (H:: Hilbert , wT:: SubQuasiArray{<:Any,2,<:Any,<:Tuple{<:AbstractAffineQuasiVector,<:Any}} )
300
+ @simplify function * (H:: Hilbert , wT:: SubQuasiArray{<:Any,2,<:Any,<:Tuple{<:AbstractAffineQuasiVector,<:Any}} )
276
301
P = parent (wT)
277
302
x = axes (P,1 )
278
303
apply (* , inv .(x .- x' ), P)[parentindices (wT)... ]
279
304
end
280
305
281
306
282
- @simplify function * (L:: LogKernel , wT:: SubQuasiArray{<:Any,2,<:Any,<:Tuple{<:AbstractAffineQuasiVector,<:Slice}} )
307
+ @simplify function * (L:: LogKernel , wT:: SubQuasiArray{<:Any,2,<:Any,<:Tuple{<:AbstractAffineQuasiVector,<:Slice}} )
283
308
V = promote_type (eltype (L), eltype (wT))
284
309
wP = parent (wT)
285
310
kr, jr = parentindices (wT)
294
319
295
320
# ## generic fallback
296
321
for Op in (:Hilbert , :StieltjesPoint , :LogKernel , :PowKernel )
297
- @eval @simplify function * (H:: $Op , wP:: WeightedBasis{<:Any,<:Weight,<:Any} )
322
+ @eval @simplify function * (H:: $Op , wP:: WeightedBasis{<:Any,<:Weight,<:Any} )
298
323
w,P = wP. args
299
324
Q = OrthogonalPolynomial (w)
300
325
(H * Weighted (Q)) * (Q \ P)
@@ -496,4 +521,4 @@ function dot(v::AbstractVector{T}, W::PowerLawMatrix, q::AbstractVector{T}) wher
496
521
vpad, qpad = paddeddata (v), paddeddata (q)
497
522
vl, ql = length (vpad), length (qpad)
498
523
return dot (vpad,W[1 : vl,1 : ql]* qpad)
499
- end
524
+ end
0 commit comments