Skip to content

Commit bc1ed81

Browse files
authored
maxspace_rule/conversion_rule for normalized returns parent (#258)
* maxspace_rule/conversion_rule for normalized returns parent * Test for conversion_type with interval * simplify implementation
1 parent 1d17f72 commit bc1ed81

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunOrthogonalPolynomials"
22
uuid = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
3-
version = "0.6.31"
3+
version = "0.6.32"
44

55
[deps]
66
ApproxFunBase = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
@@ -22,7 +22,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2222
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2323

2424
[compat]
25-
ApproxFunBase = "0.8.28"
25+
ApproxFunBase = "0.8.30"
2626
ApproxFunBaseTest = "0.1"
2727
Aqua = "0.6"
2828
BandedMatrices = "0.16, 0.17"

src/Spaces/PolynomialSpace.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,11 @@ function Fun(::typeof(identity), S::NormalizedPolynomialSpace)
476476
end
477477

478478
function conversion_rule(a::NormalizedPolynomialSpace{S}, b::S) where S<:PolynomialSpace
479-
asp = a.space
480-
c = conversion_type(asp, b)
481-
if c == asp
482-
return a
483-
else
484-
return c
485-
end
479+
conversion_type(a.space, b)
480+
end
481+
482+
function maxspace_rule(a::NormalizedPolynomialSpace{S}, b::S) where S<:PolynomialSpace
483+
maxspace(a.space, b)
486484
end
487485

488486
bandwidths(C::ConcreteConversion{NormalizedPolynomialSpace{S,D,R},S}) where {S,D,R} = (0, 0)

test/JacobiTest.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,13 @@ include("testutils.jl")
210210
end
211211

212212
@testset "conversion_type for NormalizedPolynomialSpace" begin
213-
@test conversion_type(NormalizedLegendre(), Jacobi(1,1)) == NormalizedLegendre()
214-
@test conversion_type(Jacobi(1,1), NormalizedLegendre()) == NormalizedLegendre()
215-
@test conversion_type(Jacobi(1,1), NormalizedJacobi(2,2)) == Jacobi(1,1)
216-
@test conversion_type(NormalizedJacobi(2,2), Jacobi(1,1)) == Jacobi(1,1)
213+
@test (@inferred conversion_type(NormalizedLegendre(), Jacobi(1,1))) == Legendre()
214+
@test (@inferred conversion_type(Jacobi(1,1), NormalizedLegendre())) == Legendre()
215+
@test (@inferred conversion_type(Jacobi(1,1), NormalizedJacobi(2,2))) == Jacobi(1,1)
216+
@test (@inferred conversion_type(NormalizedJacobi(2,2), Jacobi(1,1))) == Jacobi(1,1)
217+
218+
@test (@inferred (() ->
219+
conversion_type(NormalizedLegendre(0..1), Legendre(0..1)))()) == Legendre(0..1)
217220
end
218221

219222
@testset "NormalizedPolynomialSpace constructor" begin
@@ -636,6 +639,11 @@ include("testutils.jl")
636639
@test space(1 + Fun(NormalizedLegendre())) == NormalizedLegendre()
637640
@test space(1 + Fun(NormalizedJacobi(1,1,0..1))) == NormalizedJacobi(1,1,0..1)
638641
end
642+
643+
@testset "inference in maxspace/conversion_type" begin
644+
@inferred maxspace(NormalizedLegendre(), Legendre())
645+
@inferred (()->maxspace(NormalizedLegendre(0..1), Legendre(0..1)))()
646+
end
639647
end
640648

641649
@testset "casting bug ApproxFun.jl#770" begin

0 commit comments

Comments
 (0)