Skip to content

Commit 72b4eb4

Browse files
authored
Define Normalized type aliases (#175)
1 parent c000519 commit 72b4eb4

File tree

10 files changed

+17
-12
lines changed

10 files changed

+17
-12
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
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.4"
3+
version = "0.6.5"
44

55
[deps]
66
ApproxFunBase = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"

src/Spaces/Chebyshev/Chebyshev.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ end
2222
Chebyshev(d::Domain) = Chebyshev{typeof(d),real(prectype(d))}(d)
2323
Chebyshev() = Chebyshev(ChebyshevInterval())
2424
Chebyshev(d) = Chebyshev(Domain(d))
25+
const NormalizedChebyshev{D<:Domain,R} = NormalizedPolynomialSpace{Chebyshev{D, R}, D, R}
2526
NormalizedChebyshev() = NormalizedPolynomialSpace(Chebyshev())
2627
NormalizedChebyshev(d) = NormalizedPolynomialSpace(Chebyshev(d))
2728

src/Spaces/Hermite/Hermite.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct Hermite{T} <: PolynomialSpace{Line{false,Float64},Float64}
1111
end
1212
Hermite() = Hermite(1.0)
1313

14+
const NormalizedHermite{T} = NormalizedPolynomialSpace{Hermite{T},Line{false,Float64},Float64}
1415
NormalizedHermite() = NormalizedPolynomialSpace(Hermite())
1516
NormalizedHermite(L) = NormalizedPolynomialSpace(Hermite(L))
1617

src/Spaces/Jacobi/Jacobi.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Jacobi(b,a) = Jacobi(b,a,ChebyshevInterval())
2121
Jacobi(A::Ultraspherical) = Jacobi(order(A)-0.5,order(A)-0.5,domain(A))
2222
Jacobi(A::Chebyshev) = Jacobi(-0.5,-0.5,domain(A))
2323

24+
const NormalizedJacobi{D<:Domain,R,T} = NormalizedPolynomialSpace{Jacobi{D,R,T},D,R}
2425
NormalizedJacobi(s...) = NormalizedPolynomialSpace(Jacobi(s...))
2526
NormalizedLegendre(d...) = NormalizedPolynomialSpace(Legendre(d...))
2627

@@ -46,9 +47,8 @@ convert(::Type{Jacobi{D,R1,T1}},J::Jacobi{D,R2,T2}) where {D,R1,R2,T1,T2} =
4647

4748
spacescompatible(a::Jacobi,b::Jacobi) = a.a b.a && a.b b.b && domainscompatible(a,b)
4849

49-
isapproxinteger_addhalf(a) = isapproxinteger(a+0.5)
50+
isapproxinteger_addhalf(a) = !isapproxinteger(a) && isapproxinteger(a+0.5)
5051
isapproxinteger_addhalf(::Integer) = false
51-
isapproxinteger_addhalf(@nospecialize ::StaticInt) = false
5252
function canonicalspace(S::Jacobi)
5353
if isapproxinteger_addhalf(S.a) && isapproxinteger_addhalf(S.b)
5454
Chebyshev(domain(S))

src/Spaces/Jacobi/JacobiOperators.jl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,19 @@ function Conversion(L::Jacobi,M::Jacobi)
143143
dm=domain(M)
144144
if isapprox(M.a,L.a) && isapprox(M.b,L.b)
145145
ConversionWrapper(Operator(I,L))
146-
elseif (isapprox(M.b,L.b+static(1)) && isapprox(M.a,L.a)) ||
147-
(isapprox(M.b,L.b) && isapprox(M.a,L.a+static(1)))
146+
elseif (isapprox(M.b,L.b+1) && isapprox(M.a,L.a)) ||
147+
(isapprox(M.b,L.b) && isapprox(M.a,L.a+1))
148148
ConcreteConversion(L,M)
149-
elseif M.b > L.b+static(1)
149+
elseif M.b > L.b+1
150150
ConversionWrapper(
151151
TimesOperator(
152-
Conversion(Jacobi(M.b-static(1),M.a,dm),M),
153-
Conversion(L,Jacobi(M.b-static(1),M.a,dm))))
152+
Conversion(Jacobi(M.b-1,M.a,dm),M),
153+
Conversion(L,Jacobi(M.b-1,M.a,dm))))
154154
else #if M.a >= L.a+1
155155
ConversionWrapper(
156156
TimesOperator(
157-
Conversion(Jacobi(M.b,M.a-static(1),dm),M),
158-
Conversion(L,Jacobi(M.b,M.a-static(1),dm))))
157+
Conversion(Jacobi(M.b,M.a-1,dm),M),
158+
Conversion(L,Jacobi(M.b,M.a-1,dm))))
159159
end
160160
elseif L.a L.b 0 && M.a M.b 0.5
161161
Conversion(L,Ultraspherical(L),Ultraspherical(M),M)
@@ -225,7 +225,6 @@ end
225225

226226
isequalminhalf(x) = x == -0.5
227227
isequalminhalf(@nospecialize ::Integer) = false
228-
isequalminhalf(@nospecialize ::StaticInt) = false
229228

230229
function Conversion(A::Jacobi,B::Chebyshev)
231230
if isequalminhalf(A.a) && isequalminhalf(A.b)
@@ -408,7 +407,6 @@ end
408407

409408
isapproxminhalf(a) = a -0.5
410409
isapproxminhalf(::Integer) = false
411-
isapproxminhalf(@nospecialize ::StaticInt) = false
412410

413411
function union_rule(A::Jacobi,B::Jacobi)
414412
if domainscompatible(A,B)

src/Spaces/Laguerre/Laguerre.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ end
3131
Laguerre(α) = Laguerre(α,Ray())
3232
Laguerre() = Laguerre(0)
3333

34+
const NormalizedLaguerre{T<:Real,D<:Ray} = NormalizedPolynomialSpace{Laguerre{T,D},D,T}
3435
NormalizedLaguerre(α) = NormalizedPolynomialSpace(Laguerre(α))
3536
NormalizedLaguerre() = NormalizedLaguerre(0)
3637

src/Spaces/Ultraspherical/Ultraspherical.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ end
2525
Ultraspherical(m::Number,d::Domain) = Ultraspherical{typeof(m),typeof(d),real(prectype(d))}(m,d)
2626
Ultraspherical(m::Number,d) = Ultraspherical(m,Domain(d))
2727
Ultraspherical(m::Number) = Ultraspherical(m,ChebyshevInterval())
28+
const NormalizedUltraspherical{T,D<:Domain,R} = NormalizedPolynomialSpace{Ultraspherical{T,D,R},D,R}
2829
NormalizedUltraspherical(m) = NormalizedPolynomialSpace(Ultraspherical(m))
2930
NormalizedUltraspherical(m,d) = NormalizedPolynomialSpace(Ultraspherical(m,d))
3031

test/ChebyshevTest.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ using ApproxFunOrthogonalPolynomials: forwardrecurrence
253253
end
254254

255255
@testset "Normalized space" begin
256+
@test NormalizedChebyshev() isa NormalizedChebyshev
256257
for f in (x -> 3x^3 + 5x^2 + 2, x->x, identity)
257258
for dt in ((), (0..1,))
258259
S = Chebyshev(dt...)

test/JacobiTest.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ using Static
447447
end
448448

449449
@testset "Normalized space" begin
450+
@test NormalizedJacobi(1,1) isa NormalizedJacobi
450451
for f in Any[x -> 3x^3 + 5x^2 + 2, x->x, identity]
451452
for dt in Any[(), (0..1,)],
452453
S in Any[Jacobi(1,1,dt...),

test/UltrasphericalTest.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ using LinearAlgebra
4343
end
4444

4545
@testset "Normalized space" begin
46+
@test NormalizedUltraspherical(1) isa NormalizedUltraspherical
4647
for f in (x -> 3x^3 + 5x^2 + 2, x->x, identity)
4748
for dt in ((), (0..1,)),
4849
S in (Ultraspherical(1, dt...),

0 commit comments

Comments
 (0)