Skip to content

Commit 86877f1

Browse files
authored
Unify getindex for ConcreteConversion (#289)
1 parent f94e289 commit 86877f1

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

src/Spaces/Ultraspherical/UltrasphericalOperators.jl

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,8 @@ function getindex(M::ConcreteConversion{<:Chebyshev,U,T},
213213
end
214214

215215

216-
function _getindex(M::ConcreteConversion{U1,U2,T}, k, j) where {DD,RR,
217-
OT<:Union{Integer, HalfOddInteger},
218-
U1<:Ultraspherical{<:OT,DD,RR},
219-
U2<:Ultraspherical{<:OT,DD,RR},T}
220-
# we can assume that λ==m+1
221-
λ=order(rangespace(M))
216+
function _getindex(::Type{T}, λ, k, j) where {T}
217+
# we assume order(domainspace(M))+1==order(rangespace(M))
222218
c=λ-one(T) # this supports big types
223219
if k==j
224220
c/(k - 2 + λ)
@@ -232,12 +228,12 @@ end
232228
function getindex(M::ConcreteConversion{U1,U2,T}, k::Integer, j::Integer) where {DD,RR,
233229
U1<:Ultraspherical{<:Integer,DD,RR},
234230
U2<:Ultraspherical{<:Integer,DD,RR},T}
235-
_getindex(M, k, j)
231+
_getindex(T, order(rangespace(M)), k, j)
236232
end
237233
function getindex(M::ConcreteConversion{U1,U2,T}, k::Integer, j::Integer) where {DD,RR,
238234
U1<:Ultraspherical{<:HalfOddInteger,DD,RR},
239235
U2<:Ultraspherical{<:HalfOddInteger,DD,RR},T}
240-
_getindex(M, k, j)
236+
_getindex(T, order(rangespace(M)), k, j)
241237
end
242238

243239
function getindex(M::ConcreteConversion{U1,U2,T},
@@ -246,14 +242,7 @@ function getindex(M::ConcreteConversion{U1,U2,T},
246242
U2<:Ultraspherical{<:Any,DD,RR},T}
247243
λ=order(rangespace(M))
248244
if order(domainspace(M))+1==λ
249-
c=λ-one(T) # this supports big types
250-
if k==j
251-
c/(k - 2 + λ)
252-
elseif j==k+2
253-
-c/(k + λ)
254-
else
255-
zero(T)
256-
end
245+
_getindex(T, λ, k, j)
257246
else
258247
error("Not implemented")
259248
end

0 commit comments

Comments
 (0)