Skip to content

Commit 87c766d

Browse files
authored
mapped Chebyshev U Off Hilbert (#61)
* mapped Chebyshev U Off Hilbert * Update stieltjes.jl
1 parent a87e51b commit 87c766d

File tree

3 files changed

+38
-12
lines changed

3 files changed

+38
-12
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClassicalOrthogonalPolynomials"
22
uuid = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.4.4"
4+
version = "0.4.5"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/stieltjes.jl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ end
103103

104104

105105

106+
##
107+
# mapped
108+
###
109+
106110
@simplify function *(H::Hilbert, w::SubQuasiArray{<:Any,1})
107111
T = promote_type(eltype(H), eltype(w))
108112
m = parentindices(w)[1]
@@ -113,14 +117,24 @@ end
113117
(inv.(x .- x') * P)[m]
114118
end
115119

120+
116121
@simplify function *(H::Hilbert, wP::Weighted{<:Any,<:SubQuasiArray{<:Any,2}})
117122
T = promote_type(eltype(H), eltype(wP))
118123
kr,jr = parentindices(wP.P)
119-
# TODO: mapping other geometries
120-
@assert axes(H,1) == axes(H,2) == axes(wP,1)
121124
P = parent(wP.P)
122-
x = axes(P,1)
123-
(inv.(x .- x') * Weighted(P))[kr,jr]
125+
x = axes(H,1)
126+
t = axes(H,2)
127+
= axes(P,1)
128+
if x == t
129+
(inv.(t̃ .-') * Weighted(P))[kr,jr]
130+
else
131+
M = affine(t,t̃)
132+
@assert x isa Inclusion
133+
a,b = first(x),last(x)
134+
= Inclusion((M.A * a .+ M.b)..(M.A * b .+ M.b)) # map interval to new interval
135+
Q̃,M = arguments(*, inv.(x̃ .-') * Weighted(P))
136+
parent(Q̃)[affine(x,axes(parent(Q̃),1)),:] * M
137+
end
124138
end
125139

126140

test/test_stieltjes.jl

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,25 @@ end
190190
end
191191

192192
@testset "OffHilbert" begin
193-
U = ChebyshevU()
194-
W = Weighted(U)
195-
t = axes(U,1)
196-
x = Inclusion(2..3)
197-
= chebyshevt(2..3)
198-
H =\ inv.(x .- t') * W
199-
@test T̃[2.3,1:100]' * H[1:100,1:100] (inv.(2.3 .- t') * W)[:,1:100]
193+
@testset "ChebyshevU" begin
194+
U = ChebyshevU()
195+
W = Weighted(U)
196+
t = axes(U,1)
197+
x = Inclusion(2..3)
198+
T = chebyshevt(2..3)
199+
H = T \ inv.(x .- t') * W
200+
@test T[2.3,1:100]' * H[1:100,1:100] (inv.(2.3 .- t') * W)[:,1:100]
201+
end
202+
203+
@testset "mapped" begin
204+
U = chebyshevu(-1..0)
205+
W = Weighted(U)
206+
t = axes(U,1)
207+
x = Inclusion(2..3)
208+
T = chebyshevt(2..3)
209+
H = T \ inv.(x .- t') * W
210+
@test T[2.3,1:100]' * H[1:100,1:100] (inv.(2.3 .- t') * W)[:,1:100]
211+
end
200212
end
201213
end
202214

0 commit comments

Comments
 (0)