Skip to content

Commit c7e0993

Browse files
authored
Bump Julia to 0.6, fix 0.7 depwarns, remove some deprecations (#39)
1 parent 4842972 commit c7e0993

File tree

10 files changed

+94
-123
lines changed

10 files changed

+94
-123
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ os:
33
- linux
44
- osx
55
julia:
6-
- 0.5
6+
- 0.6
77
- nightly
88
notifications:
99
email: false

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Most of these functions were formerly part of Base.
99
[![Coverage Status](https://coveralls.io/repos/github/JuliaMath/SpecialFunctions.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaMath/SpecialFunctions.jl?branch=master)
1010

1111
Latest release:
12-
[![SpecialFunctions](http://pkg.julialang.org/badges/SpecialFunctions_0.5.svg)](http://pkg.julialang.org/?pkg=SpecialFunctions)
1312
[![SpecialFunctions](http://pkg.julialang.org/badges/SpecialFunctions_0.6.svg)](http://pkg.julialang.org/?pkg=SpecialFunctions)
1413

1514
Documentation:

REQUIRE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
julia 0.5
2-
Compat 0.18.0
1+
julia 0.6

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment:
22
matrix:
3-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
4-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
3+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
4+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
55
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
66
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
77

src/SpecialFunctions.jl

Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,57 @@ __precompile__()
22

33
module SpecialFunctions
44

5-
using Compat
6-
7-
if VERSION >= v"0.6.0-dev.2767"
8-
if isdefined(Base, :airyai) && VERSION < v"0.7.0-DEV.986" #22763
9-
import Base: airyai, airyaix, airyaiprime, airyaiprimex,
10-
airybi, airybix, airybiprime, airybiprimex,
11-
besselh, besselhx, besseli, besselix, besselj, besselj0, besselj1,
12-
besseljx, besselk, besselkx, bessely, bessely0, bessely1, besselyx,
13-
hankelh1, hankelh1x, hankelh2, hankelh2x,
14-
dawson, erf, erfc, erfcinv, erfcx, erfi, erfinv,
15-
eta, digamma, invdigamma, polygamma, trigamma, zeta,
16-
# deprecated
17-
airy, airyx, airyprime
18-
else
19-
export
20-
airyai,
21-
airyaiprime,
22-
airybi,
23-
airybiprime,
24-
airyaix,
25-
airyaiprimex,
26-
airybix,
27-
airybiprimex,
28-
besselh,
29-
besselhx,
30-
besseli,
31-
besselix,
32-
besselj,
33-
besselj0,
34-
besselj1,
35-
besseljx,
36-
besselk,
37-
besselkx,
38-
bessely,
39-
bessely0,
40-
bessely1,
41-
besselyx,
42-
dawson,
43-
erf,
44-
erfc,
45-
erfcinv,
46-
erfcx,
47-
erfi,
48-
erfinv,
49-
eta,
50-
digamma,
51-
invdigamma,
52-
polygamma,
53-
trigamma,
54-
hankelh1,
55-
hankelh1x,
56-
hankelh2,
57-
hankelh2x,
58-
zeta
59-
end
5+
if isdefined(Base, :airyai) && VERSION < v"0.7.0-DEV.986" #22763
6+
import Base: airyai, airyaix, airyaiprime, airyaiprimex,
7+
airybi, airybix, airybiprime, airybiprimex,
8+
besselh, besselhx, besseli, besselix, besselj, besselj0, besselj1,
9+
besseljx, besselk, besselkx, bessely, bessely0, bessely1, besselyx,
10+
hankelh1, hankelh1x, hankelh2, hankelh2x,
11+
dawson, erf, erfc, erfcinv, erfcx, erfi, erfinv,
12+
eta, digamma, invdigamma, polygamma, trigamma, zeta,
13+
# deprecated
14+
airy, airyx, airyprime
15+
else
16+
export
17+
airyai,
18+
airyaiprime,
19+
airybi,
20+
airybiprime,
21+
airyaix,
22+
airyaiprimex,
23+
airybix,
24+
airybiprimex,
25+
besselh,
26+
besselhx,
27+
besseli,
28+
besselix,
29+
besselj,
30+
besselj0,
31+
besselj1,
32+
besseljx,
33+
besselk,
34+
besselkx,
35+
bessely,
36+
bessely0,
37+
bessely1,
38+
besselyx,
39+
dawson,
40+
erf,
41+
erfc,
42+
erfcinv,
43+
erfcx,
44+
erfi,
45+
erfinv,
46+
eta,
47+
digamma,
48+
invdigamma,
49+
polygamma,
50+
trigamma,
51+
hankelh1,
52+
hankelh1x,
53+
hankelh2,
54+
hankelh2x,
55+
zeta
6056
end
6157

6258
export sinint,
@@ -68,6 +64,13 @@ else
6864
const openspecfun = "libopenspecfun"
6965
end
7066

67+
# Avoids a deprecation warning for the 0-arg case on 0.7
68+
if VERSION < v"0.7.0-DEV.924"
69+
const DomainErrorNoArgs = DomainError()
70+
else
71+
const DomainErrorNoArgs = DomainError(nothing)
72+
end
73+
7174
include("bessel.jl")
7275
include("erf.jl")
7376
include("sincosint.jl")

src/bessel.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using Base.Math: nan_dom_err
44

5-
type AmosException <: Exception
5+
struct AmosException <: Exception
66
info::Int32
77
end
88

@@ -112,11 +112,11 @@ for afn in (:airyai, :airyaiprime, :airybi, :airybiprime,
112112
:airyaix, :airyaiprimex, :airybix, :airybiprimex)
113113
@eval begin
114114
$afn(z::Complex) = $afn(float(z))
115-
$afn{T<:AbstractFloat}(z::Complex{T}) = throw(MethodError($afn,(z,)))
115+
$afn(z::Complex{<:AbstractFloat}) = throw(MethodError($afn,(z,)))
116116
$afn(z::Complex64) = Complex64($afn(Complex128(z)))
117117
end
118118
if afn in (:airyaix, :airyaiprimex)
119-
@eval $afn(x::Real) = x < 0 ? throw(DomainError()) : real($afn(complex(float(x))))
119+
@eval $afn(x::Real) = x < 0 ? throw(DomainErrorNoArgs) : real($afn(complex(float(x))))
120120
else
121121
@eval $afn(x::Real) = real($afn(complex(float(x))))
122122
end
@@ -312,13 +312,13 @@ besselkx(nu::Float64, z::Complex128) = _besselk(abs(nu), z, Int32(2))
312312

313313
function bessely(nu::Cint, x::Float64)
314314
if x < 0
315-
throw(DomainError())
315+
throw(DomainErrorNoArgs)
316316
end
317317
ccall((:yn, libm), Float64, (Cint, Float64), nu, x)
318318
end
319319
function bessely(nu::Cint, x::Float32)
320320
if x < 0
321-
throw(DomainError())
321+
throw(DomainErrorNoArgs)
322322
end
323323
ccall((:ynf, libm), Float32, (Cint, Float32), nu, x)
324324
end
@@ -346,7 +346,7 @@ Modified Bessel function of the first kind of order `nu`, ``I_\\nu(x)``.
346346
"""
347347
function besseli(nu::Real, x::AbstractFloat)
348348
if x < 0 && !isinteger(nu)
349-
throw(DomainError())
349+
throw(DomainErrorNoArgs)
350350
end
351351
real(besseli(float(nu), complex(x)))
352352
end
@@ -358,7 +358,7 @@ Scaled modified Bessel function of the first kind of order `nu`, ``I_\\nu(x) e^{
358358
"""
359359
function besselix(nu::Real, x::AbstractFloat)
360360
if x < 0 && !isinteger(nu)
361-
throw(DomainError())
361+
throw(DomainErrorNoArgs)
362362
end
363363
real(besselix(float(nu), complex(x)))
364364
end
@@ -374,7 +374,7 @@ function besselj(nu::Real, x::AbstractFloat)
374374
return besselj(Cint(nu), x)
375375
end
376376
elseif x < 0
377-
throw(DomainError())
377+
throw(DomainErrorNoArgs)
378378
end
379379
real(besselj(float(nu), complex(x)))
380380
end
@@ -386,7 +386,7 @@ Scaled Bessel function of the first kind of order `nu`, ``J_\\nu(x) e^{- | \\ope
386386
"""
387387
function besseljx(nu::Real, x::AbstractFloat)
388388
if x < 0 && !isinteger(nu)
389-
throw(DomainError())
389+
throw(DomainErrorNoArgs)
390390
end
391391
real(besseljx(float(nu), complex(x)))
392392
end
@@ -398,7 +398,7 @@ Modified Bessel function of the second kind of order `nu`, ``K_\\nu(x)``.
398398
"""
399399
function besselk(nu::Real, x::AbstractFloat)
400400
if x < 0
401-
throw(DomainError())
401+
throw(DomainErrorNoArgs)
402402
elseif x == 0
403403
return oftype(x, Inf)
404404
end
@@ -412,7 +412,7 @@ Scaled modified Bessel function of the second kind of order `nu`, ``K_\\nu(x) e^
412412
"""
413413
function besselkx(nu::Real, x::AbstractFloat)
414414
if x < 0
415-
throw(DomainError())
415+
throw(DomainErrorNoArgs)
416416
elseif x == 0
417417
return oftype(x, Inf)
418418
end
@@ -426,7 +426,7 @@ Bessel function of the second kind of order `nu`, ``Y_\\nu(x)``.
426426
"""
427427
function bessely(nu::Real, x::AbstractFloat)
428428
if x < 0
429-
throw(DomainError())
429+
throw(DomainErrorNoArgs)
430430
elseif isinteger(nu) && typemin(Cint) <= nu <= typemax(Cint)
431431
return bessely(Cint(nu), x)
432432
end
@@ -441,7 +441,7 @@ Scaled Bessel function of the second kind of order `nu`,
441441
"""
442442
function besselyx(nu::Real, x::AbstractFloat)
443443
if x < 0
444-
throw(DomainError())
444+
throw(DomainErrorNoArgs)
445445
end
446446
real(besselyx(float(nu), complex(x)))
447447
end
@@ -454,7 +454,7 @@ for f in ("i", "ix", "j", "jx", "k", "kx", "y", "yx")
454454
Tf = promote_type(float(typeof(nu)),float(typeof(real(z))))
455455
$bfn(Tf(nu), Complex{Tf}(z))
456456
end
457-
$bfn{T<:AbstractFloat}(k::T, z::Complex{T}) = throw(MethodError($bfn,(k,z)))
457+
$bfn(k::T, z::Complex{T}) where {T<:AbstractFloat} = throw(MethodError($bfn,(k,z)))
458458
$bfn(nu::Float32, x::Complex64) = Complex64($bfn(Float64(nu), Complex128(x)))
459459
end
460460
end
@@ -471,7 +471,7 @@ for bfn in (:besselh, :besselhx)
471471
$bfn(Tf(nu), k, Complex{Tf}(z))
472472
end
473473

474-
$bfn{T<:AbstractFloat}(nu::T, k::Integer, z::Complex{T}) = throw(MethodError($bfn,(nu,k,z)))
474+
$bfn(nu::T, k::Integer, z::Complex{T}) where {T<:AbstractFloat} = throw(MethodError($bfn,(nu,k,z)))
475475
$bfn(nu::Float32, k::Integer, x::Complex64) = Complex64($bfn(Float64(nu), k, Complex128(x)))
476476
end
477477
end
@@ -511,7 +511,7 @@ Bessel function of the second kind of order 0, ``Y_0(x)``.
511511
"""
512512
function bessely0(x::BigFloat)
513513
if x < 0
514-
throw(DomainError())
514+
throw(DomainErrorNoArgs)
515515
end
516516
z = BigFloat()
517517
ccall((:mpfr_y0, :libmpfr), Int32, (Ptr{BigFloat}, Ptr{BigFloat}, Int32), &z, &x, ROUNDING_MODE[])
@@ -525,7 +525,7 @@ Bessel function of the second kind of order 1, ``Y_1(x)``.
525525
"""
526526
function bessely1(x::BigFloat)
527527
if x < 0
528-
throw(DomainError())
528+
throw(DomainErrorNoArgs)
529529
end
530530
z = BigFloat()
531531
ccall((:mpfr_y1, :libmpfr), Int32, (Ptr{BigFloat}, Ptr{BigFloat}, Int32), &z, &x, ROUNDING_MODE[])
@@ -534,7 +534,7 @@ end
534534

535535
function bessely(n::Integer, x::BigFloat)
536536
if x < 0
537-
throw(DomainError())
537+
throw(DomainErrorNoArgs)
538538
end
539539
z = BigFloat()
540540
ccall((:mpfr_yn, :libmpfr), Int32, (Ptr{BigFloat}, Clong, Ptr{BigFloat}, Int32), &z, n, &x, ROUNDING_MODE[])

src/deprecated.jl

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
11
# This file contains code that was formerly a part of Julia. License is MIT: http://julialang.org/license
22

3-
using Base: @deprecate, depwarn
4-
using Compat: @dep_vectorize_1arg, @dep_vectorize_2arg
5-
6-
for f in (:digamma, :trigamma, :zeta, :eta, :erfcx, :erfi, :dawson, :airyai, :airyaiprime,
7-
:airybi, :airybiprime, :besselj0, :besselj1, :bessely0, :bessely1, :erf, :erfc)
8-
@eval @dep_vectorize_1arg Number $f
9-
end
10-
11-
for f in (:invdigamma, :erfinc, :erfcinv)
12-
@eval @dep_vectorize_1arg Real $f
13-
end
14-
15-
for f in (:polygamma, :zeta, :besseli, :besselix, :besselj, :besseljx, :besselk, :besselkx,
16-
:bessely, :besselyx, :besselh, :besselhx, :hankelh1, :hankelh2, :hankelh1x, :hankelh2x)
17-
@eval @dep_vectorize_2arg Number $f
18-
end
19-
203
@deprecate airy(z::Number) airyai(z)
214
@deprecate airyx(z::Number) airyaix(z)
225
@deprecate airyprime(z::Number) airyaiprime(z)
23-
@deprecate airy{T<:Number}(x::AbstractArray{T}) airyai.(x)
24-
@deprecate airyx{T<:Number}(x::AbstractArray{T}) airyaix.(x)
25-
@deprecate airyprime{T<:Number}(x::AbstractArray{T}) airyprime.(x)
266

277
function _airy(k::Integer, z::Complex128)
28-
depwarn("`airy(k,x)` is deprecated, use `airyai(x)`, `airyaiprime(x)`, `airybi(x)` or `airybiprime(x)` instead.",:airy)
8+
Base.depwarn("`airy(k,x)` is deprecated, use `airyai(x)`, `airyaiprime(x)`, `airybi(x)` or `airybiprime(x)` instead.",:airy)
299
id = Int32(k==1 || k==3)
3010
if k == 0 || k == 1
3111
return _airy(z, id, Int32(1))
@@ -36,7 +16,7 @@ function _airy(k::Integer, z::Complex128)
3616
end
3717
end
3818
function _airyx(k::Integer, z::Complex128)
39-
depwarn("`airyx(k,x)` is deprecated, use `airyaix(x)`, `airyaiprimex(x)`, `airybix(x)` or `airybiprimex(x)` instead.",:airyx)
19+
Base.depwarn("`airyx(k,x)` is deprecated, use `airyaix(x)`, `airyaiprimex(x)`, `airybix(x)` or `airybiprimex(x)` instead.",:airyx)
4020
id = Int32(k==1 || k==3)
4121
if k == 0 || k == 1
4222
return _airy(z, id, Int32(2))
@@ -54,24 +34,14 @@ for afn in (:airy,:airyx)
5434
function $afn(k::Integer, z::Complex128)
5535
afn = $(QuoteNode(afn))
5636
suf = $(QuoteNode(suf))
57-
depwarn("`$afn(k,x)` is deprecated, use `airyai$suf(x)`, `airyaiprime$suf(x)`, `airybi$suf(x)` or `airybiprime$suf(x)` instead.",$(QuoteNode(afn)))
37+
Base.depwarn("`$afn(k,x)` is deprecated, use `airyai$suf(x)`, `airyaiprime$suf(x)`, `airybi$suf(x)` or `airybiprime$suf(x)` instead.",$(QuoteNode(afn)))
5838
$_afn(k,z)
5939
end
6040

6141
$afn(k::Integer, z::Complex) = $afn(k, float(z))
62-
$afn{T<:AbstractFloat}(k::Integer, z::Complex{T}) = throw(MethodError($afn,(k,z)))
42+
$afn(k::Integer, z::Complex{<:AbstractFloat}) = throw(MethodError($afn,(k,z)))
6343
$afn(k::Integer, z::Complex64) = Complex64($afn(k, Complex128(z)))
6444
$afn(k::Integer, x::Real) = $afn(k, float(x))
6545
$afn(k::Integer, x::AbstractFloat) = real($afn(k, complex(x)))
66-
67-
function $afn{T<:Number}(k::Number, x::AbstractArray{T})
68-
$afn.(k,x)
69-
end
70-
function $afn{S<:Number}(k::AbstractArray{S}, x::Number)
71-
$afn.(k,x)
72-
end
73-
function $afn{S<:Number,T<:Number}(k::AbstractArray{S}, x::AbstractArray{T})
74-
$afn.(k,x)
75-
end
7646
end
7747
end

0 commit comments

Comments
 (0)