Skip to content

Commit e355685

Browse files
authored
Remove some special functions from Base (#20427)
1 parent 1c64cc9 commit e355685

15 files changed

+33
-1970
lines changed

base/deprecated.jl

+21-73
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,9 @@ for f in (
228228
# base/special/log.jl
229229
:log, :log1p,
230230
# base/special/gamma.jl
231-
:gamma, :lfact, :digamma, :trigamma, :zeta, :eta,
232-
# base/special/erf.jl
233-
:erfcx, :erfi, :dawson,
234-
# base/special/bessel.jl
235-
:airyai, :airyaiprime, :airybi, :airybiprime,
236-
:besselj0, :besselj1, :bessely0, :bessely1,
231+
:gamma, :lfact,
237232
# base/math.jl
238-
:cbrt, :sinh, :cosh, :tanh, :atan, :asinh, :exp, :erf, :erfc, :exp2,
233+
:cbrt, :sinh, :cosh, :tanh, :atan, :asinh, :exp, :exp2,
239234
:expm1, :exp10, :sin, :cos, :tan, :asin, :acos, :acosh, :atanh,
240235
#=:log,=# :log2, :log10, :lgamma, #=:log1p,=# :sqrt,
241236
# base/floatfuncs.jl
@@ -254,8 +249,6 @@ for f in ( :acos_fast, :acosh_fast, :angle_fast, :asin_fast, :asinh_fast,
254249
@eval FastMath Base.@dep_vectorize_1arg Number $f
255250
end
256251
for f in (
257-
:invdigamma, # base/special/gamma.jl
258-
:erfinc, :erfcinv, # base/special/erf.jl
259252
:trunc, :floor, :ceil, :round, # base/floatfuncs.jl
260253
:rad2deg, :deg2rad, :exponent, :significand, # base/math.jl
261254
:sind, :cosd, :tand, :asind, :acosd, :atand, :asecd, :acscd, :acotd, # base/special/trig.jl
@@ -294,11 +287,7 @@ end
294287
# Deprecate @vectorize_2arg-vectorized functions from...
295288
for f in (
296289
# base/special/gamma.jl
297-
:polygamma, :zeta, :beta, :lbeta,
298-
# base/special/bessel.jl
299-
:besseli, :besselix, :besselj, :besseljx,
300-
:besselk, :besselkx, :bessely, :besselyx, :besselh,
301-
:besselhx, :hankelh1, :hankelh2, :hankelh1x, :hankelh2x,
290+
:beta, :lbeta,
302291
# base/math.jl
303292
:log, :hypot, :atan2,
304293
)
@@ -674,65 +663,6 @@ end
674663
# Deprecate isimag (#19947).
675664
@deprecate isimag(z::Number) iszero(real(z))
676665

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

12321162
# TODO: remove warning for using `_` in parse_input_line in base/client.jl
12331163

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

12361184
# BEGIN 1.0 deprecations

base/docs/helpdb/Base.jl

-66
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

-39
Original file line numberDiff line numberDiff line change
@@ -313,19 +313,11 @@ export
313313
csc,
314314
cscd,
315315
csch,
316-
dawson,
317316
deg2rad,
318317
denominator,
319-
digamma,
320318
div,
321319
divrem,
322320
eps,
323-
erf,
324-
erfc,
325-
erfcinv,
326-
erfcx,
327-
erfi,
328-
erfinv,
329321
exp,
330322
exp10,
331323
exp2,
@@ -349,7 +341,6 @@ export
349341
hypot,
350342
imag,
351343
inv,
352-
invdigamma,
353344
invmod,
354345
isapprox,
355346
iseven,
@@ -420,7 +411,6 @@ export
420411
tanh,
421412
trailing_ones,
422413
trailing_zeros,
423-
trigamma,
424414
trunc,
425415
unsafe_trunc,
426416
typemax,
@@ -434,37 +424,8 @@ export
434424
,
435425

436426
# specfun
437-
airyai,
438-
airyaiprime,
439-
airybi,
440-
airybiprime,
441-
airyaix,
442-
airyaiprimex,
443-
airybix,
444-
airybiprimex,
445-
besselh,
446-
besselhx,
447-
besseli,
448-
besselix,
449-
besselj,
450-
besselj0,
451-
besselj1,
452-
besseljx,
453-
besselk,
454-
besselkx,
455-
bessely,
456-
bessely0,
457-
bessely1,
458-
besselyx,
459427
beta,
460-
eta,
461-
hankelh1,
462-
hankelh1x,
463-
hankelh2,
464-
hankelh2x,
465428
lbeta,
466-
polygamma,
467-
zeta,
468429

469430
# arrays
470431
broadcast!,

0 commit comments

Comments
 (0)