Skip to content

Commit 1d17f72

Browse files
authored
rename isapproxinteger_addhalf to isapproxhalfoddinteger (#257)
1 parent f838847 commit 1d17f72

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/ApproxFunOrthogonalPolynomials.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ isequalhalf(x) = x == _onehalf(x)
162162
isequalhalf(@nospecialize(a::StaticInt)) = false
163163
isequalhalf(x::Integer) = false
164164

165-
isapproxinteger_addhalf(a) = !isapproxinteger(a) && isapproxinteger(a+_onehalf(a))
166-
isapproxinteger_addhalf(a::HalfOddInteger) = true
167-
isapproxinteger_addhalf(@nospecialize(a::StaticInt)) = false
168-
function isapproxinteger_addhalf(a::StaticFloat64)
165+
isapproxhalfoddinteger(a) = !isapproxinteger(a) && isapproxinteger(a+_onehalf(a))
166+
isapproxhalfoddinteger(a::HalfOddInteger) = true
167+
isapproxhalfoddinteger(@nospecialize(a::StaticInt)) = false
168+
function isapproxhalfoddinteger(a::StaticFloat64)
169169
x = mod(a, static(1))
170170
x == _onehalf(x) || dynamic(x) 0.5
171171
end
172-
isapproxinteger_addhalf(::Integer) = false
172+
isapproxhalfoddinteger(::Integer) = false
173173

174174
include("bary.jl")
175175

src/Spaces/Jacobi/Jacobi.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ compare_orders((Aa, Ba)::NTuple{2,Number}, (Ab, Bb)::NTuple{2,Number}) = compare
6969
spacescompatible(a::Jacobi, b::Jacobi) = compare_orders((a.a, b.a), (a.b, b.b)) && domainscompatible(a,b)
7070

7171
function canonicalspace(S::Jacobi)
72-
if isapproxinteger_addhalf(S.a) && isapproxinteger_addhalf(S.b)
72+
if isapproxhalfoddinteger(S.a) && isapproxhalfoddinteger(S.b)
7373
Chebyshev(domain(S))
7474
else
7575
# return space with parameters in (-1,0.]

src/Spaces/Jacobi/JacobiOperators.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function Conversion(L::Jacobi,M::Jacobi)
175175
else
176176
return _conversion_shiftordersbyone(L, M)
177177
end
178-
elseif isapproxinteger_addhalf(L.a - M.a) && isapproxinteger_addhalf(L.b - M.b)
178+
elseif isapproxhalfoddinteger(L.a - M.a) && isapproxhalfoddinteger(L.b - M.b)
179179
if L.a L.b && M.a M.b && isapproxminhalf(M.a)
180180
return Conversion(L,Ultraspherical(L),Chebyshev(dm),M)
181181
elseif L.a L.b && isapproxminhalf(L.a) && M.a M.b && M.a >= L.a
@@ -485,7 +485,7 @@ for (OPrule,OP) in ((:conversion_rule,:conversion_type), (:maxspace_rule,:maxspa
485485
if isapproxminhalf(B.a) && isapproxminhalf(B.b)
486486
# the spaces are the same
487487
A
488-
elseif isapproxinteger_addhalf(B.a) && isapproxinteger_addhalf(B.b)
488+
elseif isapproxhalfoddinteger(B.a) && isapproxhalfoddinteger(B.b)
489489
$OP(Jacobi(A),B)
490490
else
491491
NoSpace()
@@ -496,7 +496,7 @@ for (OPrule,OP) in ((:conversion_rule,:conversion_type), (:maxspace_rule,:maxspa
496496
if isapproxminhalf(B.a - m) && isapproxminhalf(B.b - m)
497497
# the spaces are the same
498498
A
499-
elseif isapproxinteger_addhalf(B.a) && isapproxinteger_addhalf(B.b)
499+
elseif isapproxhalfoddinteger(B.a) && isapproxhalfoddinteger(B.b)
500500
$OP(Jacobi(A),B)
501501
else
502502
NoSpace()

src/Spaces/Ultraspherical/UltrasphericalOperators.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function Conversion(A::Chebyshev, B::Ultraspherical)
143143
dB = domain(B)
144144
if isequalhalf(mB) || mB == 1
145145
return ConcreteConversion(A,B)
146-
elseif (isinteger(mB) || isapproxinteger_addhalf(mB)) && mB > 0
146+
elseif (isinteger(mB) || isapproxhalfoddinteger(mB)) && mB > 0
147147
r = mB:-1:(isinteger(mB) ? 2 : 1)
148148
v = [ConcreteConversion(Ultraspherical(i-1, d), Ultraspherical(i,d)) for i in r]
149149
U = domainspace(last(v))
@@ -173,7 +173,7 @@ function Conversion(A::Ultraspherical,B::Ultraspherical)
173173
d=domain(A)
174174
if b==a
175175
return ConversionWrapper(Operator(I,A))
176-
elseif isapproxinteger(b-a) || isapproxinteger_addhalf(b-a)
176+
elseif isapproxinteger(b-a) || isapproxhalfoddinteger(b-a)
177177
if -1 b-a 1 && (a,b) (2,1)
178178
return ConcreteConversion(A,B)
179179
elseif b-a > 1

test/runtests.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module ApproxFunOrthogonalPolynomials_Runtests
22

33
using ApproxFunOrthogonalPolynomials
4-
using ApproxFunOrthogonalPolynomials: isapproxminhalf, isequalminhalf, isequalhalf, isapproxinteger_addhalf
4+
using ApproxFunOrthogonalPolynomials: isapproxminhalf, isequalminhalf, isequalhalf, isapproxhalfoddinteger
55
using LinearAlgebra
66
using Test
77
using Aqua
@@ -46,11 +46,11 @@ include("testutils.jl")
4646
@test !isequalhalf(1)
4747
@test !isequalhalf(static(1))
4848

49-
@test isapproxinteger_addhalf(0.5)
50-
@test isapproxinteger_addhalf(static(0.5))
51-
@test isapproxinteger_addhalf(half(Odd(1)))
52-
@test !isapproxinteger_addhalf(1)
53-
@test !isapproxinteger_addhalf(static(1))
49+
@test isapproxhalfoddinteger(0.5)
50+
@test isapproxhalfoddinteger(static(0.5))
51+
@test isapproxhalfoddinteger(half(Odd(1)))
52+
@test !isapproxhalfoddinteger(1)
53+
@test !isapproxhalfoddinteger(static(1))
5454

5555
@test ApproxFunOrthogonalPolynomials._minonehalf(2) == -0.5
5656
@test ApproxFunOrthogonalPolynomials._onehalf(2) == 0.5

0 commit comments

Comments
 (0)