Skip to content

Commit 2a759ef

Browse files
authored
assert domain compatibility in conversions (#193)
1 parent 2974d01 commit 2a759ef

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Spaces/Jacobi/JacobiOperators.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,14 @@ end
229229
# Assume m is compatible
230230

231231
function Conversion(A::PolynomialSpace,B::Jacobi)
232+
@assert domain(A) == domain(B)
232233
J = Jacobi(A)
233234
J == B ? ConcreteConversion(A,B) :
234235
ConversionWrapper(TimesOperator(Conversion(J,B),Conversion(A,J)))
235236
end
236237

237238
function Conversion(A::Jacobi,B::PolynomialSpace)
239+
@assert domain(A) == domain(B)
238240
J = Jacobi(B)
239241
J == A ? ConcreteConversion(A,B) :
240242
ConversionWrapper(TimesOperator(Conversion(J,B),Conversion(A,J)))
@@ -244,6 +246,7 @@ isequalminhalf(x) = x == -0.5
244246
isequalminhalf(@nospecialize ::Integer) = false
245247

246248
function Conversion(A::Jacobi,B::Chebyshev)
249+
@assert domain(A) == domain(B)
247250
if isequalminhalf(A.a) && isequalminhalf(A.b)
248251
ConcreteConversion(A,B)
249252
elseif A.a == A.b == 0
@@ -261,6 +264,7 @@ function Conversion(A::Jacobi,B::Chebyshev)
261264
end
262265

263266
function Conversion(A::Chebyshev,B::Jacobi)
267+
@assert domain(A) == domain(B)
264268
if isequalminhalf(B.a) && isequalminhalf(B.b)
265269
ConcreteConversion(A,B)
266270
elseif B.a == B.b == 0
@@ -279,6 +283,7 @@ end
279283

280284

281285
function Conversion(A::Jacobi,B::Ultraspherical)
286+
@assert domain(A) == domain(B)
282287
if isequalminhalf(A.a) && isequalminhalf(A.b)
283288
ConversionWrapper(Conversion(Chebyshev(domain(A)),B)*
284289
ConcreteConversion(A,Chebyshev(domain(A))))
@@ -299,6 +304,7 @@ function Conversion(A::Jacobi,B::Ultraspherical)
299304
end
300305

301306
function Conversion(A::Ultraspherical,B::Jacobi)
307+
@assert domain(A) == domain(B)
302308
if isequalminhalf(B.a) && isequalminhalf(B.b)
303309
ConversionWrapper(ConcreteConversion(Chebyshev(domain(A)),B)*
304310
Conversion(A,Chebyshev(domain(A))))

src/Spaces/Ultraspherical/UltrasphericalOperators.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ isequalhalf(x) = x == 0.5
128128
isequalhalf(::Integer) = false
129129

130130
function Conversion(A::Chebyshev, B::Ultraspherical)
131+
@assert domain(A) == domain(B)
131132
mB = order(B)
132133
d=domain(A)
133134
dB = domain(B)
134-
d == dB || throw(ArgumentError("domains must be identical"))
135135
if isequalhalf(mB) || mB == 1
136136
return ConcreteConversion(A,B)
137137
elseif (isinteger(mB) || isapproxinteger_addhalf(mB)) && mB > 0
@@ -147,6 +147,7 @@ function Conversion(A::Chebyshev, B::Ultraspherical)
147147
end
148148

149149
function Conversion(A::Ultraspherical,B::Chebyshev)
150+
@assert domain(A) == domain(B)
150151
if isequalhalf(order(A)) && domain(A) == domain(B)
151152
return ConcreteConversion(A,B)
152153
end
@@ -158,10 +159,9 @@ maxspace_rule(A::Ultraspherical,B::Chebyshev) = A
158159

159160

160161
function Conversion(A::Ultraspherical,B::Ultraspherical)
162+
@assert domain(A) == domain(B)
161163
a=order(A); b=order(B)
162164
d=domain(A)
163-
dB = domain(B)
164-
d == dB || throw(ArgumentError("domains must be identical"))
165165
if b==a
166166
return ConversionWrapper(Operator(I,A))
167167
elseif isapproxinteger(b-a) || isapproxinteger_addhalf(b-a)

0 commit comments

Comments
 (0)