Skip to content

Commit 033a9ec

Browse files
authored
Fix some 0.7 deprecations (#66)
1 parent 9151a95 commit 033a9ec

File tree

6 files changed

+54
-54
lines changed

6 files changed

+54
-54
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
julia 0.6
2-
Compat 0.30
2+
Compat 0.38.0
33
BinDeps

src/bessel.jl

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function Base.showerror(io::IO, ex::AmosException)
2626
end
2727

2828
## Airy functions
29-
function _airy(z::Complex128, id::Int32, kode::Int32)
29+
function _airy(z::Complex{Float64}, id::Int32, kode::Int32)
3030
ai1, ai2 = Ref{Float64}(), Ref{Float64}()
3131
ae1, ae2 = Ref{Int32}(), Ref{Int32}()
3232

@@ -43,7 +43,7 @@ function _airy(z::Complex128, id::Int32, kode::Int32)
4343
end
4444
end
4545

46-
function _biry(z::Complex128, id::Int32, kode::Int32)
46+
function _biry(z::Complex{Float64}, id::Int32, kode::Int32)
4747
ai1, ai2 = Ref{Float64}(), Ref{Float64}()
4848
ae1 = Ref{Int32}()
4949

@@ -67,31 +67,31 @@ end
6767
Airy function of the first kind ``\\operatorname{Ai}(x)``.
6868
"""
6969
function airyai end
70-
airyai(z::Complex128) = _airy(z, Int32(0), Int32(1))
70+
airyai(z::Complex{Float64}) = _airy(z, Int32(0), Int32(1))
7171

7272
"""
7373
airyaiprime(x)
7474
7575
Derivative of the Airy function of the first kind ``\\operatorname{Ai}'(x)``.
7676
"""
7777
function airyaiprime end
78-
airyaiprime(z::Complex128) = _airy(z, Int32(1), Int32(1))
78+
airyaiprime(z::Complex{Float64}) = _airy(z, Int32(1), Int32(1))
7979

8080
"""
8181
airybi(x)
8282
8383
Airy function of the second kind ``\\operatorname{Bi}(x)``.
8484
"""
8585
function airybi end
86-
airybi(z::Complex128) = _biry(z, Int32(0), Int32(1))
86+
airybi(z::Complex{Float64}) = _biry(z, Int32(0), Int32(1))
8787

8888
"""
8989
airybiprime(x)
9090
9191
Derivative of the Airy function of the second kind ``\\operatorname{Bi}'(x)``.
9292
"""
9393
function airybiprime end
94-
airybiprime(z::Complex128) = _biry(z, Int32(1), Int32(1))
94+
airybiprime(z::Complex{Float64}) = _biry(z, Int32(1), Int32(1))
9595

9696
"""
9797
airyaix(x)
@@ -100,7 +100,7 @@ Scaled Airy function of the first kind ``\\operatorname{Ai}(x) e^{\\frac{2}{3} x
100100
\\sqrt{x}}``. Throws `DomainError` for negative `Real` arguments.
101101
"""
102102
function airyaix end
103-
airyaix(z::Complex128) = _airy(z, Int32(0), Int32(2))
103+
airyaix(z::Complex{Float64}) = _airy(z, Int32(0), Int32(2))
104104

105105
"""
106106
airyaiprimex(x)
@@ -109,30 +109,30 @@ Scaled derivative of the Airy function of the first kind ``\\operatorname{Ai}'(x
109109
e^{\\frac{2}{3} x \\sqrt{x}}``. Throws `DomainError` for negative `Real` arguments.
110110
"""
111111
function airyaiprimex end
112-
airyaiprimex(z::Complex128) = _airy(z, Int32(1), Int32(2))
112+
airyaiprimex(z::Complex{Float64}) = _airy(z, Int32(1), Int32(2))
113113

114114
"""
115115
airybix(x)
116116
117117
Scaled Airy function of the second kind ``\\operatorname{Bi}(x) e^{- \\left| \\operatorname{Re} \\left( \\frac{2}{3} x \\sqrt{x} \\right) \\right|}``.
118118
"""
119119
function airybix end
120-
airybix(z::Complex128) = _biry(z, Int32(0), Int32(2))
120+
airybix(z::Complex{Float64}) = _biry(z, Int32(0), Int32(2))
121121

122122
"""
123123
airybiprimex(x)
124124
125125
Scaled derivative of the Airy function of the second kind ``\\operatorname{Bi}'(x) e^{- \\left| \\operatorname{Re} \\left( \\frac{2}{3} x \\sqrt{x} \\right) \\right|}``.
126126
"""
127127
function airybiprimex end
128-
airybiprimex(z::Complex128) = _biry(z, Int32(1), Int32(2))
128+
airybiprimex(z::Complex{Float64}) = _biry(z, Int32(1), Int32(2))
129129

130130
for afn in (:airyai, :airyaiprime, :airybi, :airybiprime,
131131
:airyaix, :airyaiprimex, :airybix, :airybiprimex)
132132
@eval begin
133133
$afn(z::Complex) = $afn(float(z))
134134
$afn(z::Complex{<:AbstractFloat}) = throw(MethodError($afn,(z,)))
135-
$afn(z::Complex64) = Complex64($afn(Complex128(z)))
135+
$afn(z::Complex{Float32}) = Complex{Float32}($afn(Complex{Float64}(z)))
136136
end
137137
if afn in (:airyaix, :airyaiprimex)
138138
@eval $afn(x::Real) = x < 0 ? throw(DomainError(x, "`x` must be nonnegative.")) : real($afn(complex(float(x))))
@@ -172,7 +172,7 @@ for jy in ("j","y"), nu in (0,1)
172172
end
173173

174174

175-
function _besselh(nu::Float64, k::Int32, z::Complex128, kode::Int32)
175+
function _besselh(nu::Float64, k::Int32, z::Complex{Float64}, kode::Int32)
176176
ai1, ai2 = Ref{Float64}(), Ref{Float64}()
177177
ae1, ae2 = Ref{Int32}(), Ref{Int32}()
178178

@@ -189,7 +189,7 @@ function _besselh(nu::Float64, k::Int32, z::Complex128, kode::Int32)
189189
end
190190
end
191191

192-
function _besseli(nu::Float64, z::Complex128, kode::Int32)
192+
function _besseli(nu::Float64, z::Complex{Float64}, kode::Int32)
193193
ai1, ai2 = Ref{Float64}(), Ref{Float64}()
194194
ae1, ae2 = Ref{Int32}(), Ref{Int32}()
195195

@@ -206,7 +206,7 @@ function _besseli(nu::Float64, z::Complex128, kode::Int32)
206206
end
207207
end
208208

209-
function _besselj(nu::Float64, z::Complex128, kode::Int32)
209+
function _besselj(nu::Float64, z::Complex{Float64}, kode::Int32)
210210
ai1, ai2 = Ref{Float64}(), Ref{Float64}()
211211
ae1, ae2 = Ref{Int32}(), Ref{Int32}()
212212

@@ -223,7 +223,7 @@ function _besselj(nu::Float64, z::Complex128, kode::Int32)
223223
end
224224
end
225225

226-
function _besselk(nu::Float64, z::Complex128, kode::Int32)
226+
function _besselk(nu::Float64, z::Complex{Float64}, kode::Int32)
227227
ai1, ai2 = Ref{Float64}(), Ref{Float64}()
228228
ae1, ae2 = Ref{Int32}(), Ref{Int32}()
229229

@@ -240,7 +240,7 @@ function _besselk(nu::Float64, z::Complex128, kode::Int32)
240240
end
241241
end
242242

243-
function _bessely(nu::Float64, z::Complex128, kode::Int32)
243+
function _bessely(nu::Float64, z::Complex{Float64}, kode::Int32)
244244
ai1, ai2 = Ref{Float64}(), Ref{Float64}()
245245
ae1, ae2 = Ref{Int32}(), Ref{Int32}()
246246
wrk1, wrk2 = Ref{Float64}(), Ref{Float64}()
@@ -268,7 +268,7 @@ selecting [`hankelh1`](@ref) or [`hankelh2`](@ref), respectively.
268268
"""
269269
function besselh end
270270

271-
function besselh(nu::Float64, k::Integer, z::Complex128)
271+
function besselh(nu::Float64, k::Integer, z::Complex{Float64})
272272
if nu < 0
273273
s = (k == 1) ? 1 : -1
274274
return _besselh(-nu,Int32(k),z,Int32(1)) * complex(cospi(nu),-s*sinpi(nu))
@@ -291,15 +291,15 @@ exponential factor (analytically), so it avoids these problems.
291291
"""
292292
function besselhx end
293293

294-
function besselhx(nu::Float64, k::Integer, z::Complex128)
294+
function besselhx(nu::Float64, k::Integer, z::Complex{Float64})
295295
if nu < 0
296296
s = (k == 1) ? 1 : -1
297297
return _besselh(-nu,Int32(k),z,Int32(2)) * complex(cospi(nu),-s*sinpi(nu))
298298
end
299299
return _besselh(nu,Int32(k),z,Int32(2))
300300
end
301301

302-
function besseli(nu::Float64, z::Complex128)
302+
function besseli(nu::Float64, z::Complex{Float64})
303303
if nu < 0
304304
if isinteger(nu)
305305
return _besseli(-nu,z,Int32(1))
@@ -311,7 +311,7 @@ function besseli(nu::Float64, z::Complex128)
311311
end
312312
end
313313

314-
function besselix(nu::Float64, z::Complex128)
314+
function besselix(nu::Float64, z::Complex{Float64})
315315
if nu < 0
316316
if isinteger(nu)
317317
return _besseli(-nu,z,Int32(2))
@@ -323,7 +323,7 @@ function besselix(nu::Float64, z::Complex128)
323323
end
324324
end
325325

326-
function besselj(nu::Float64, z::Complex128)
326+
function besselj(nu::Float64, z::Complex{Float64})
327327
if nu < 0
328328
if isinteger(nu)
329329
return _besselj(-nu,z,Int32(1))*cospi(nu)
@@ -339,7 +339,7 @@ besselj(nu::Cint, x::Float64) = ccall((:jn, libm), Float64, (Cint, Float64), nu,
339339
besselj(nu::Cint, x::Float32) = ccall((:jnf, libm), Float32, (Cint, Float32), nu, x)
340340

341341

342-
function besseljx(nu::Float64, z::Complex128)
342+
function besseljx(nu::Float64, z::Complex{Float64})
343343
if nu < 0
344344
if isinteger(nu)
345345
return _besselj(-nu,z,Int32(2))*cospi(nu)
@@ -351,9 +351,9 @@ function besseljx(nu::Float64, z::Complex128)
351351
end
352352
end
353353

354-
besselk(nu::Float64, z::Complex128) = _besselk(abs(nu), z, Int32(1))
354+
besselk(nu::Float64, z::Complex{Float64}) = _besselk(abs(nu), z, Int32(1))
355355

356-
besselkx(nu::Float64, z::Complex128) = _besselk(abs(nu), z, Int32(2))
356+
besselkx(nu::Float64, z::Complex{Float64}) = _besselk(abs(nu), z, Int32(2))
357357

358358
function bessely(nu::Cint, x::Float64)
359359
if x < 0
@@ -368,15 +368,15 @@ function bessely(nu::Cint, x::Float32)
368368
ccall((:ynf, libm), Float32, (Cint, Float32), nu, x)
369369
end
370370

371-
function bessely(nu::Float64, z::Complex128)
371+
function bessely(nu::Float64, z::Complex{Float64})
372372
if nu < 0
373373
return _bessely(-nu,z,Int32(1))*cospi(nu) - _besselj(-nu,z,Int32(1))*sinpi(nu)
374374
else
375375
return _bessely(nu,z,Int32(1))
376376
end
377377
end
378378

379-
function besselyx(nu::Float64, z::Complex128)
379+
function besselyx(nu::Float64, z::Complex{Float64})
380380
if nu < 0
381381
return _bessely(-nu,z,Int32(2))*cospi(nu) - _besselj(-nu,z,Int32(2))*sinpi(nu)
382382
else
@@ -500,7 +500,7 @@ for f in ("i", "ix", "j", "jx", "k", "kx", "y", "yx")
500500
$bfn(Tf(nu), Complex{Tf}(z))
501501
end
502502
$bfn(k::T, z::Complex{T}) where {T<:AbstractFloat} = throw(MethodError($bfn,(k,z)))
503-
$bfn(nu::Float32, x::Complex64) = Complex64($bfn(Float64(nu), Complex128(x)))
503+
$bfn(nu::Float32, x::Complex{Float32}) = Complex{Float32}($bfn(Float64(nu), Complex{Float64}(x)))
504504
end
505505
end
506506

@@ -517,7 +517,7 @@ for bfn in (:besselh, :besselhx)
517517
end
518518

519519
$bfn(nu::T, k::Integer, z::Complex{T}) where {T<:AbstractFloat} = throw(MethodError($bfn,(nu,k,z)))
520-
$bfn(nu::Float32, k::Integer, x::Complex64) = Complex64($bfn(Float64(nu), k, Complex128(x)))
520+
$bfn(nu::Float32, k::Integer, x::Complex{Float32}) = Complex{Float32}($bfn(Float64(nu), k, Complex{Float64}(x)))
521521
end
522522
end
523523

src/deprecated.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@deprecate airyx(z::Number) airyaix(z)
55
@deprecate airyprime(z::Number) airyaiprime(z)
66

7-
function _airy(k::Integer, z::Complex128)
7+
function _airy(k::Integer, z::Complex{Float64})
88
Base.depwarn("`airy(k,x)` is deprecated, use `airyai(x)`, `airyaiprime(x)`, `airybi(x)` or `airybiprime(x)` instead.",:airy)
99
id = Int32(k==1 || k==3)
1010
if k == 0 || k == 1
@@ -15,7 +15,7 @@ function _airy(k::Integer, z::Complex128)
1515
throw(DomainError(k, "`k` must be between 0 and 3."))
1616
end
1717
end
18-
function _airyx(k::Integer, z::Complex128)
18+
function _airyx(k::Integer, z::Complex{Float64})
1919
Base.depwarn("`airyx(k,x)` is deprecated, use `airyaix(x)`, `airyaiprimex(x)`, `airybix(x)` or `airybiprimex(x)` instead.",:airyx)
2020
id = Int32(k==1 || k==3)
2121
if k == 0 || k == 1
@@ -31,7 +31,7 @@ for afn in (:airy,:airyx)
3131
_afn = Symbol("_"*string(afn))
3232
suf = string(afn)[5:end]
3333
@eval begin
34-
function $afn(k::Integer, z::Complex128)
34+
function $afn(k::Integer, z::Complex{Float64})
3535
afn = $(QuoteNode(afn))
3636
suf = $(QuoteNode(suf))
3737
Base.depwarn("`$afn(k,x)` is deprecated, use `airyai$suf(x)`, `airyaiprime$suf(x)`, `airybi$suf(x)` or `airybiprime$suf(x)` instead.",$(QuoteNode(afn)))
@@ -40,7 +40,7 @@ for afn in (:airy,:airyx)
4040

4141
$afn(k::Integer, z::Complex) = $afn(k, float(z))
4242
$afn(k::Integer, z::Complex{<:AbstractFloat}) = throw(MethodError($afn,(k,z)))
43-
$afn(k::Integer, z::Complex64) = Complex64($afn(k, Complex128(z)))
43+
$afn(k::Integer, z::Complex{Float32}) = Complex{Float32}($afn(k, Complex{Float64}(z)))
4444
$afn(k::Integer, x::Real) = $afn(k, float(x))
4545
$afn(k::Integer, x::AbstractFloat) = real($afn(k, complex(x)))
4646
end

src/erf.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ for f in (:erf, :erfc)
99
($f)(x::Float32) = ccall(($(string(f,"f")),libm), Float32, (Float32,), x)
1010
($f)(x::Real) = ($f)(float(x))
1111
($f)(a::Float16) = Float16($f(Float32(a)))
12-
($f)(a::Complex32) = Complex32($f(Complex64(a)))
12+
($f)(a::Complex{Float16}) = Complex{Float16}($f(Complex{Float32}(a)))
1313
function ($f)(x::BigFloat)
1414
z = BigFloat()
1515
ccall(($(string(:mpfr_,f)), :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Int32), z, x, ROUNDING_MODE[])
@@ -22,9 +22,9 @@ end
2222
for f in (:erf, :erfc, :erfcx, :erfi, :Dawson)
2323
fname = (f === :Dawson) ? :dawson : f
2424
@eval begin
25-
($fname)(z::Complex128) = Complex128(ccall(($(string("Faddeeva_",f)),openspecfun), Complex{Float64}, (Complex{Float64}, Float64), z, zero(Float64)))
26-
($fname)(z::Complex64) = Complex64(ccall(($(string("Faddeeva_",f)),openspecfun), Complex{Float64}, (Complex{Float64}, Float64), Complex128(z), Float64(eps(Float32))))
27-
($fname)(z::Complex) = ($fname)(Complex128(z))
25+
($fname)(z::Complex{Float64}) = Complex{Float64}(ccall(($(string("Faddeeva_",f)),openspecfun), Complex{Float64}, (Complex{Float64}, Float64), z, zero(Float64)))
26+
($fname)(z::Complex{Float32}) = Complex{Float32}(ccall(($(string("Faddeeva_",f)),openspecfun), Complex{Float64}, (Complex{Float64}, Float64), Complex{Float64}(z), Float64(eps(Float32))))
27+
($fname)(z::Complex) = ($fname)(Complex{Float64}(z))
2828
end
2929
end
3030

src/gamma.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ function cotderiv_q(m::Int)
100100
q₋ = cotderiv_q(m-1)
101101
d = length(q₋) - 1 # degree of q₋
102102
if isodd(m-1)
103-
q = Array{Float64}(length(q₋))
103+
q = Vector{Float64}(uninitialized, length(q₋))
104104
q[end] = d * q₋[end] * 2/m
105105
for i = 1:length(q)-1
106106
q[i] = ((i-1)*q₋[i] + i*q₋[i+1]) * 2/m
107107
end
108108
else # iseven(m-1)
109-
q = Array{Float64}(length(q₋) + 1)
109+
q = Vector{Float64}(uninitialized, length(q₋) + 1)
110110
q[1] = q₋[1] / m
111111
q[end] = (1 + 2d) * q₋[end] / m
112112
for i = 2:length(q)-1
@@ -486,7 +486,7 @@ end
486486

487487

488488
for T in (Float16, Float32, Float64)
489-
@eval f64(x::Complex{$T}) = Complex128(x)
489+
@eval f64(x::Complex{$T}) = Complex{Float64}(x)
490490
@eval f64(x::$T) = Float64(x)
491491
end
492492

0 commit comments

Comments
 (0)