Skip to content

Commit 00a6cda

Browse files
committed
Remove some special functions from Base
1 parent 7f34449 commit 00a6cda

File tree

15 files changed

+32
-1956
lines changed

15 files changed

+32
-1956
lines changed

base/deprecated.jl

Lines changed: 20 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,9 @@ for f in (
226226
# base/special/log.jl
227227
:log, :log1p,
228228
# base/special/gamma.jl
229-
:gamma, :lfact, :digamma, :trigamma, :zeta, :eta,
230-
# base/special/erf.jl
231-
:erfcx, :erfi, :dawson,
232-
# base/special/bessel.jl
233-
:airyai, :airyaiprime, :airybi, :airybiprime,
234-
:besselj0, :besselj1, :bessely0, :bessely1,
229+
:gamma, :lfact,
235230
# base/math.jl
236-
:cbrt, :sinh, :cosh, :tanh, :atan, :asinh, :exp, :erf, :erfc, :exp2,
231+
:cbrt, :sinh, :cosh, :tanh, :atan, :asinh, :exp, :exp2,
237232
:expm1, :exp10, :sin, :cos, :tan, :asin, :acos, :acosh, :atanh,
238233
#=:log,=# :log2, :log10, :lgamma, #=:log1p,=# :sqrt,
239234
# base/floatfuncs.jl
@@ -252,8 +247,6 @@ for f in ( :acos_fast, :acosh_fast, :angle_fast, :asin_fast, :asinh_fast,
252247
@eval FastMath Base.@dep_vectorize_1arg Number $f
253248
end
254249
for f in (
255-
:invdigamma, # base/special/gamma.jl
256-
:erfinc, :erfcinv, # base/special/erf.jl
257250
:trunc, :floor, :ceil, :round, # base/floatfuncs.jl
258251
:rad2deg, :deg2rad, :exponent, :significand, # base/math.jl
259252
:sind, :cosd, :tand, :asind, :acosd, :atand, :asecd, :acscd, :acotd, # base/special/trig.jl
@@ -292,11 +285,7 @@ end
292285
# Deprecate @vectorize_2arg-vectorized functions from...
293286
for f in (
294287
# base/special/gamma.jl
295-
:polygamma, :zeta, :beta, :lbeta,
296-
# base/special/bessel.jl
297-
:besseli, :besselix, :besselj, :besseljx,
298-
:besselk, :besselkx, :bessely, :besselyx, :besselh,
299-
:besselhx, :hankelh1, :hankelh2, :hankelh1x, :hankelh2x,
288+
:beta, :lbeta,
300289
# base/math.jl
301290
:log, :hypot, :atan2,
302291
)
@@ -672,65 +661,6 @@ end
672661
# Deprecate isimag (#19947).
673662
@deprecate isimag(z::Number) iszero(real(z))
674663

675-
@deprecate airy(z::Number) airyai(z)
676-
@deprecate airyx(z::Number) airyaix(z)
677-
@deprecate airyprime(z::Number) airyaiprime(z)
678-
@deprecate airy{T<:Number}(x::AbstractArray{T}) airyai.(x)
679-
@deprecate airyx{T<:Number}(x::AbstractArray{T}) airyaix.(x)
680-
@deprecate airyprime{T<:Number}(x::AbstractArray{T}) airyprime.(x)
681-
682-
function _airy(k::Integer, z::Complex128)
683-
depwarn("`airy(k,x)` is deprecated, use `airyai(x)`, `airyaiprime(x)`, `airybi(x)` or `airybiprime(x)` instead.",:airy)
684-
id = Int32(k==1 || k==3)
685-
if k == 0 || k == 1
686-
return Base.Math._airy(z, id, Int32(1))
687-
elseif k == 2 || k == 3
688-
return Base.Math._biry(z, id, Int32(1))
689-
else
690-
throw(ArgumentError("k must be between 0 and 3"))
691-
end
692-
end
693-
function _airyx(k::Integer, z::Complex128)
694-
depwarn("`airyx(k,x)` is deprecated, use `airyaix(x)`, `airyaiprimex(x)`, `airybix(x)` or `airybiprimex(x)` instead.",:airyx)
695-
id = Int32(k==1 || k==3)
696-
if k == 0 || k == 1
697-
return Base.Math._airy(z, id, Int32(2))
698-
elseif k == 2 || k == 3
699-
return Base.Math._biry(z, id, Int32(2))
700-
else
701-
throw(ArgumentError("k must be between 0 and 3"))
702-
end
703-
end
704-
705-
for afn in (:airy,:airyx)
706-
_afn = Symbol("_"*string(afn))
707-
suf = string(afn)[5:end]
708-
@eval begin
709-
function $afn(k::Integer, z::Complex128)
710-
afn = $(QuoteNode(afn))
711-
suf = $(QuoteNode(suf))
712-
depwarn("`$afn(k,x)` is deprecated, use `airyai$suf(x)`, `airyaiprime$suf(x)`, `airybi$suf(x)` or `airybiprime$suf(x)` instead.",$(QuoteNode(afn)))
713-
$_afn(k,z)
714-
end
715-
716-
$afn(k::Integer, z::Complex) = $afn(k, float(z))
717-
$afn{T<:AbstractFloat}(k::Integer, z::Complex{T}) = throw(MethodError($afn,(k,z)))
718-
$afn(k::Integer, z::Complex64) = Complex64($afn(k, Complex128(z)))
719-
$afn(k::Integer, x::Real) = $afn(k, float(x))
720-
$afn(k::Integer, x::AbstractFloat) = real($afn(k, complex(x)))
721-
722-
function $afn{T<:Number}(k::Number, x::AbstractArray{T})
723-
$afn.(k,x)
724-
end
725-
function $afn{S<:Number}(k::AbstractArray{S}, x::Number)
726-
$afn.(k,x)
727-
end
728-
function $afn{S<:Number,T<:Number}(k::AbstractArray{S}, x::AbstractArray{T})
729-
$afn.(k,x)
730-
end
731-
end
732-
end
733-
734664
# Deprecate vectorized xor in favor of compact broadcast syntax
735665
@deprecate xor(a::Bool, B::BitArray) xor.(a, B)
736666
@deprecate xor(A::BitArray, b::Bool) xor.(A, b)
@@ -1227,6 +1157,23 @@ for name in ("alnum", "alpha", "cntrl", "digit", "number", "graph",
12271157
@eval @deprecate ($f)(s::AbstractString) all($f, s)
12281158
end
12291159

1160+
# Special functions have been moved to a package
1161+
for f in (:airyai, :airyaiprime, :airybi, :airybiprime, :airyaix, :airyaiprimex, :airybix, :airybiprimex,
1162+
:besselh, :besselhx, :besseli, :besselix, :besselj, :besselj0, :besselj1, :besseljx, :besselk,
1163+
:besselkx, :bessely, :bessely0, :bessely1, :besselyx,
1164+
:dawson, :erf, :erfc, :erfcinv, :erfcx, :erfi, :erfinv,
1165+
:eta, :zeta, :digamma, :invdigamma, :polygamma, :trigamma,
1166+
:hankelh1, :hankelh1x, :hankelh2, :hankelh2x)
1167+
@eval begin
1168+
function $f(args...; kwargs...)
1169+
error(string($f, args, " has been moved to the package SpecialFunctions.jl.\n",
1170+
"Run Pkg.add(\"SpecialFunctions\") to install SpecialFunctions on Julia v0.6 and later,\n",
1171+
"and then run `using SpecialFunctions`."))
1172+
end
1173+
export $f
1174+
end
1175+
end
1176+
12301177
# END 0.6 deprecations
12311178

12321179
# BEGIN 1.0 deprecations

base/docs/helpdb/Base.jl

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,6 @@ This would create a 25-by-30000 `BitArray`, linked to the file associated with s
304304
"""
305305
Mmap.mmap(io, ::BitArray, dims = ?, offset = ?)
306306

307-
"""
308-
bessely0(x)
309-
310-
Bessel function of the second kind of order 0, ``Y_0(x)``.
311-
"""
312-
bessely0
313-
314307
"""
315308
filter!(function, collection)
316309
@@ -647,13 +640,6 @@ for use in `Mmap.mmap`. Used by `SharedArray` for creating shared memory arrays.
647640
"""
648641
Mmap.Anonymous
649642

650-
"""
651-
erfi(x)
652-
653-
Compute the imaginary error function of `x`, defined by ``-i \\operatorname{erf}(ix)``.
654-
"""
655-
erfi
656-
657643
"""
658644
floor([T,] x, [digits, [base]])
659645
@@ -695,13 +681,6 @@ The item or field is not defined for the given object.
695681
"""
696682
UndefRefError
697683

698-
"""
699-
bessely1(x)
700-
701-
Bessel function of the second kind of order 1, ``Y_1(x)``.
702-
"""
703-
bessely1
704-
705684
"""
706685
append!(collection, collection2) -> collection.
707686
@@ -798,13 +777,6 @@ julia> getfield(a, :num)
798777
"""
799778
getfield
800779

801-
"""
802-
besselj1(x)
803-
804-
Bessel function of the first kind of order 1, ``J_1(x)``.
805-
"""
806-
besselj1
807-
808780
"""
809781
select!(v, k, [by=<transform>,] [lt=<comparison>,] [rev=false])
810782
@@ -933,35 +905,13 @@ behavior, including program corruption or segfaults, at any later time.
933905
"""
934906
unsafe_convert
935907

936-
"""
937-
erfinv(x)
938-
939-
Compute the inverse error function of a real `x`, defined by ``\\operatorname{erf}(\\operatorname{erfinv}(x)) = x``.
940-
"""
941-
erfinv
942-
943908
"""
944909
seek(s, pos)
945910
946911
Seek a stream to the given position.
947912
"""
948913
seek
949914

950-
"""
951-
besselj0(x)
952-
953-
Bessel function of the first kind of order 0, ``J_0(x)``.
954-
"""
955-
besselj0
956-
957-
"""
958-
erfcinv(x)
959-
960-
Compute the inverse error complementary function of a real `x`, defined by
961-
``\\operatorname{erfc}(\\operatorname{erfcinv}(x)) = x``.
962-
"""
963-
erfcinv
964-
965915
"""
966916
popdisplay()
967917
popdisplay(d::Display)
@@ -1605,14 +1555,6 @@ Equivalent to [`readdlm`](@ref) with `delim` set to comma, and type optionally d
16051555
"""
16061556
readcsv
16071557

1608-
"""
1609-
erfcx(x)
1610-
1611-
Compute the scaled complementary error function of `x`, defined by ``e^{x^2} \\operatorname{erfc}(x)``.
1612-
Note also that ``\\operatorname{erfcx}(-ix)`` computes the Faddeeva function ``w(x)``.
1613-
"""
1614-
erfcx
1615-
16161558
"""
16171559
UndefVarError(var::Symbol)
16181560
@@ -2482,11 +2424,3 @@ seekend
24822424
Integer division was attempted with a denominator value of 0.
24832425
"""
24842426
DivideError
2485-
2486-
"""
2487-
dawson(x)
2488-
2489-
Compute the Dawson function (scaled imaginary error function) of `x`, defined by
2490-
``\\frac{\\sqrt{\\pi}}{2} e^{-x^2} \\operatorname{erfi}(x)``.
2491-
"""
2492-
dawson

base/exports.jl

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -309,19 +309,11 @@ export
309309
csc,
310310
cscd,
311311
csch,
312-
dawson,
313312
deg2rad,
314313
denominator,
315-
digamma,
316314
div,
317315
divrem,
318316
eps,
319-
erf,
320-
erfc,
321-
erfcinv,
322-
erfcx,
323-
erfi,
324-
erfinv,
325317
exp,
326318
exp10,
327319
exp2,
@@ -345,7 +337,6 @@ export
345337
hypot,
346338
imag,
347339
inv,
348-
invdigamma,
349340
invmod,
350341
isapprox,
351342
iseven,
@@ -416,7 +407,6 @@ export
416407
tanh,
417408
trailing_ones,
418409
trailing_zeros,
419-
trigamma,
420410
trunc,
421411
unsafe_trunc,
422412
typemax,
@@ -430,37 +420,8 @@ export
430420
,
431421

432422
# specfun
433-
airyai,
434-
airyaiprime,
435-
airybi,
436-
airybiprime,
437-
airyaix,
438-
airyaiprimex,
439-
airybix,
440-
airybiprimex,
441-
besselh,
442-
besselhx,
443-
besseli,
444-
besselix,
445-
besselj,
446-
besselj0,
447-
besselj1,
448-
besseljx,
449-
besselk,
450-
besselkx,
451-
bessely,
452-
bessely0,
453-
bessely1,
454-
besselyx,
455423
beta,
456-
eta,
457-
hankelh1,
458-
hankelh1x,
459-
hankelh2,
460-
hankelh2x,
461424
lbeta,
462-
polygamma,
463-
zeta,
464425

465426
# arrays
466427
broadcast!,

base/math.jl

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,10 @@ export sin, cos, tan, sinh, cosh, tanh, asin, acos, atan,
1010
acosd, acotd, acscd, asecd, asind, atand, atan2,
1111
rad2deg, deg2rad,
1212
log, log2, log10, log1p, exponent, exp, exp2, exp10, expm1,
13-
cbrt, sqrt, erf, erfc, erfcx, erfi, dawson,
14-
significand,
13+
cbrt, sqrt, significand,
1514
lgamma, hypot, gamma, lfact, max, min, minmax, ldexp, frexp,
1615
clamp, clamp!, modf, ^, mod2pi, rem2pi,
17-
airyai, airyaiprime, airybi, airybiprime,
18-
airyaix, airyaiprimex, airybix, airybiprimex,
19-
besselj0, besselj1, besselj, besseljx,
20-
bessely0, bessely1, bessely, besselyx,
21-
hankelh1, hankelh2, hankelh1x, hankelh2x,
22-
besseli, besselix, besselk, besselkx, besselh, besselhx,
23-
beta, lbeta, eta, zeta, polygamma, invdigamma, digamma, trigamma,
24-
erfinv, erfcinv, @evalpoly
16+
beta, lbeta, @evalpoly
2517

2618
import Base: log, exp, sin, cos, tan, sinh, cosh, tanh, asin,
2719
acos, atan, asinh, acosh, atanh, sqrt, log2, log10,
@@ -224,28 +216,13 @@ Compute the inverse hyperbolic sine of `x`.
224216
"""
225217
asinh(x)
226218

227-
"""
228-
erf(x)
229-
230-
Compute the error function of `x`, defined by ``\\frac{2}{\\sqrt{\\pi}} \\int_0^x e^{-t^2} dt``
231-
for arbitrary complex `x`.
232-
"""
233-
erf(x)
234-
235-
"""
236-
erfc(x)
237-
238-
Compute the complementary error function of `x`, defined by ``1 - \\operatorname{erf}(x)``.
239-
"""
240-
erfc(x)
241-
242219
"""
243220
expm1(x)
244221
245222
Accurately compute ``e^x-1``.
246223
"""
247224
expm1(x)
248-
for f in (:cbrt, :sinh, :cosh, :tanh, :atan, :asinh, :erf, :erfc, :exp2, :expm1)
225+
for f in (:cbrt, :sinh, :cosh, :tanh, :atan, :asinh, :exp2, :expm1)
249226
@eval begin
250227
($f)(x::Float64) = ccall(($(string(f)),libm), Float64, (Float64,), x)
251228
($f)(x::Float32) = ccall(($(string(f,"f")),libm), Float32, (Float32,), x)
@@ -284,7 +261,7 @@ julia> exp2(5)
284261
```
285262
"""
286263
exp2(x::AbstractFloat) = 2^x
287-
for f in (:sinh, :cosh, :tanh, :atan, :asinh, :exp, :erf, :erfc, :expm1)
264+
for f in (:sinh, :cosh, :tanh, :atan, :asinh, :exp, :expm1)
288265
@eval ($f)(x::AbstractFloat) = error("not implemented for ", typeof(x))
289266
end
290267

@@ -918,7 +895,7 @@ muladd(x,y,z) = x*y+z
918895
# Float16 definitions
919896

920897
for func in (:sin,:cos,:tan,:asin,:acos,:atan,:sinh,:cosh,:tanh,:asinh,:acosh,
921-
:atanh,:exp,:log,:log2,:log10,:sqrt,:lgamma,:log1p,:erf,:erfc)
898+
:atanh,:exp,:log,:log2,:log10,:sqrt,:lgamma,:log1p)
922899
@eval begin
923900
$func(a::Float16) = Float16($func(Float32(a)))
924901
$func(a::Complex32) = Complex32($func(Complex64(a)))
@@ -935,8 +912,6 @@ cbrt(a::Float16) = Float16(cbrt(Float32(a)))
935912

936913
# More special functions
937914
include("special/trig.jl")
938-
include("special/bessel.jl")
939-
include("special/erf.jl")
940915
include("special/gamma.jl")
941916

942917
module JuliaLibm

0 commit comments

Comments
 (0)