From 4d56e6e441ee8ef16233c2606317a51ba5f53f23 Mon Sep 17 00:00:00 2001 From: Mus M Date: Tue, 10 Jan 2017 11:05:13 -0500 Subject: [PATCH] Rename to SpecialFunctions --- base/math/math.jl | 6 +-- base/mpfr.jl | 2 +- base/special/special.jl | 4 +- base/sysimg.jl | 2 +- doc/src/stdlib/math.md | 90 ++++++++++++++++++++--------------------- test/math.jl | 28 ++++++------- 6 files changed, 66 insertions(+), 66 deletions(-) diff --git a/base/math/math.jl b/base/math/math.jl index de6ef0f54cfe93..cf43bc16ea639e 100644 --- a/base/math/math.jl +++ b/base/math/math.jl @@ -13,16 +13,16 @@ export exp, exp2, exp10, expm1, cotd, cscd, secd, acotd, acscd, asecd, rad2deg, deg2rad, exponent, significand, ldexp, frexp, - sqrt, cbrt, ^, hypot, modf, + sqrt, cbrt, ^, hypot, clamp, clamp!, max, min, minmax, - clamp, clamp!, mod2pi, @evalpoly + modf, mod2pi, rem2pi, @evalpoly import Base: exp, exp2, exp10, expm1, log, log2, log10, log1p, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, sqrt, ^, - max, min, minmax, muladd + max, min, minmax, rem, muladd using Base: sign_mask, exponent_mask, exponent_one, exponent_bias, exponent_half, exponent_max, exponent_raw_max, fpinttype, diff --git a/base/mpfr.jl b/base/mpfr.jl index 325bc6698ea70b..cbb3884682ab6f 100644 --- a/base/mpfr.jl +++ b/base/mpfr.jl @@ -24,7 +24,7 @@ import Base.Rounding: rounding_raw, setrounding_raw import Base.GMP: ClongMax, CulongMax, CdoubleMax, Limb -import Base.SpecFun.lgamma_r +import Base.SpecialFunctions.lgamma_r function __init__() try diff --git a/base/special/special.jl b/base/special/special.jl index faa655591da5af..0885d7f782aae7 100644 --- a/base/special/special.jl +++ b/base/special/special.jl @@ -1,6 +1,6 @@ # This file is a part of Julia. License is MIT: http://julialang.org/license -module SpecFun +module SpecialFunctions export erf, erfc, erfcx, erfi, dawson, lgamma, gamma, lfact, @@ -13,7 +13,7 @@ export erf, erfc, erfcx, erfi, dawson, beta, lbeta, eta, zeta, polygamma, invdigamma, digamma, trigamma, erfinv, erfcinv -import Base.Math: @horner +using Base.Math: @horner const libm = Base.libm_name const openspecfun = "libopenspecfun" diff --git a/base/sysimg.jl b/base/sysimg.jl index 1aee3c08419d56..e0cbe5d626582d 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -238,7 +238,7 @@ const (∛)=cbrt # special math functions include("special/special.jl") -importall .SpecFun +importall .SpecialFunctions # reduction along dims include("reducedim.jl") # macros in this file relies on string.jl diff --git a/doc/src/stdlib/math.md b/doc/src/stdlib/math.md index b4f9d06bf32153..01f92212272ac7 100644 --- a/doc/src/stdlib/math.md +++ b/doc/src/stdlib/math.md @@ -153,13 +153,6 @@ Base.flipsign Base.sqrt Base.isqrt Base.Math.cbrt -Base.SpecFun.erf -Base.SpecFun.erfc -Base.SpecFun.erfcx -Base.SpecFun.erfi -Base.SpecFun.dawson -Base.SpecFun.erfinv -Base.SpecFun.erfcinv Base.real(::Complex) Base.imag Base.reim @@ -179,44 +172,51 @@ Base.prevpow Base.nextprod Base.invmod Base.powermod -Base.SpecFun.gamma -Base.SpecFun.lgamma -Base.SpecFun.lfact -Base.SpecFun.digamma -Base.SpecFun.invdigamma -Base.SpecFun.trigamma -Base.SpecFun.polygamma -Base.SpecFun.airyai -Base.SpecFun.airyaiprime -Base.SpecFun.airyaix -Base.SpecFun.airyaiprimex -Base.SpecFun.airybi -Base.SpecFun.airybiprime -Base.SpecFun.airybix -Base.SpecFun.airybiprimex -Base.SpecFun.besselj0 -Base.SpecFun.besselj1 -Base.SpecFun.besselj -Base.SpecFun.besseljx -Base.SpecFun.bessely0 -Base.SpecFun.bessely1 -Base.SpecFun.bessely -Base.SpecFun.besselyx -Base.SpecFun.hankelh1 -Base.SpecFun.hankelh1x -Base.SpecFun.hankelh2 -Base.SpecFun.hankelh2x -Base.SpecFun.besselh -Base.SpecFun.besselhx -Base.SpecFun.besseli -Base.SpecFun.besselix -Base.SpecFun.besselk -Base.SpecFun.besselkx -Base.SpecFun.beta -Base.SpecFun.lbeta -Base.SpecFun.eta -Base.SpecFun.zeta(::Complex) -Base.SpecFun.zeta(::Any, ::Any) +Base.SpecialFunctions.erf +Base.SpecialFunctions.erfc +Base.SpecialFunctions.erfcx +Base.SpecialFunctions.erfi +Base.SpecialFunctions.dawson +Base.SpecialFunctions.erfinv +Base.SpecialFunctions.erfcinv +Base.SpecialFunctions.gamma +Base.SpecialFunctions.lgamma +Base.SpecialFunctions.lfact +Base.SpecialFunctions.digamma +Base.SpecialFunctions.invdigamma +Base.SpecialFunctions.trigamma +Base.SpecialFunctions.polygamma +Base.SpecialFunctions.airyai +Base.SpecialFunctions.airyaiprime +Base.SpecialFunctions.airyaix +Base.SpecialFunctions.airyaiprimex +Base.SpecialFunctions.airybi +Base.SpecialFunctions.airybiprime +Base.SpecialFunctions.airybix +Base.SpecialFunctions.airybiprimex +Base.SpecialFunctions.besselj0 +Base.SpecialFunctions.besselj1 +Base.SpecialFunctions.besselj +Base.SpecialFunctions.besseljx +Base.SpecialFunctions.bessely0 +Base.SpecialFunctions.bessely1 +Base.SpecialFunctions.bessely +Base.SpecialFunctions.besselyx +Base.SpecialFunctions.hankelh1 +Base.SpecialFunctions.hankelh1x +Base.SpecialFunctions.hankelh2 +Base.SpecialFunctions.hankelh2x +Base.SpecialFunctions.besselh +Base.SpecialFunctions.besselhx +Base.SpecialFunctions.besseli +Base.SpecialFunctions.besselix +Base.SpecialFunctions.besselk +Base.SpecialFunctions.besselkx +Base.SpecialFunctions.beta +Base.SpecialFunctions.lbeta +Base.SpecialFunctions.eta +Base.SpecialFunctions.zeta(::Complex) +Base.SpecialFunctions.zeta(::Any, ::Any) Base.ndigits Base.widemul Base.Math.@evalpoly diff --git a/test/math.jl b/test/math.jl index 8faf8cb8296a42..9791f8102c4ce2 100644 --- a/test/math.jl +++ b/test/math.jl @@ -426,8 +426,8 @@ end end @testset "airy" begin - @test_throws Base.SpecFun.AmosException airyai(200im) - @test_throws Base.SpecFun.AmosException airybi(200) + @test_throws Base.SpecialFunctions.AmosException airyai(200im) + @test_throws Base.SpecialFunctions.AmosException airybi(200) for T in [Float32, Float64, Complex64,Complex128] @test airyai(T(1.8)) ≈ 0.0470362168668458052247 @@ -484,7 +484,7 @@ end @test besselh(3,2,3) ≈ conj(true_h133) @test besselh(-3,2,3) ≈ -conj(true_h133) @testset "Error throwing" begin - @test_throws Base.SpecFun.AmosException besselh(1,0) + @test_throws Base.SpecialFunctions.AmosException besselh(1,0) @test_throws MethodError besselh(1,big(1.0)) @test_throws MethodError besselh(1,complex(big(1.0))) @test_throws MethodError besselhx(1,big(1.0)) @@ -499,7 +499,7 @@ end @test besseli(-3,-3) ≈ -true_i33 @test besseli(Float32(-3),Complex64(-3,0)) ≈ -true_i33 @testset "Error throwing" begin - @test_throws Base.SpecFun.AmosException besseli(1,1000) + @test_throws Base.SpecialFunctions.AmosException besseli(1,1000) @test_throws DomainError besseli(0.4,-1.0) @test_throws MethodError besseli(1,big(1.0)) @test_throws MethodError besseli(1,complex(big(1.0))) @@ -544,7 +544,7 @@ end @test besselj(1.0,3im) ≈ besselj(1,3im) @testset "Error throwing" begin @test_throws DomainError besselj(0.1, -0.4) - @test_throws Base.SpecFun.AmosException besselj(20,1000im) + @test_throws Base.SpecialFunctions.AmosException besselj(20,1000im) @test_throws MethodError besselj(big(1.0),3im) end end @@ -559,7 +559,7 @@ end # issue #6564 @test besselk(1.0,0.0) == Inf @testset "Error throwing" begin - @test_throws Base.SpecFun.AmosException besselk(200,0.01) + @test_throws Base.SpecialFunctions.AmosException besselk(200,0.01) @test_throws DomainError besselk(3,-3) @test_throws MethodError besselk(1,big(1.0)) @test_throws MethodError besselk(1,complex(big(1.0))) @@ -577,7 +577,7 @@ end @test y33 ≈ -0.53854161610503161800 @test bessely(3,complex(-3)) ≈ 0.53854161610503161800 - 0.61812544451050328724im @testset "Error throwing" begin - @test_throws Base.SpecFun.AmosException bessely(200.5,0.1) + @test_throws Base.SpecialFunctions.AmosException bessely(200.5,0.1) @test_throws DomainError bessely(3,-3) @test_throws DomainError bessely(0.4,-1.0) @test_throws DomainError bessely(0.4,Float32(-1.0)) @@ -617,11 +617,11 @@ end end @test besselkx(1, 0) == Inf @testset "Error throwing" begin - @test_throws Base.SpecFun.AmosException hankelh1x(1, 0) - @test_throws Base.SpecFun.AmosException hankelh2x(1, 0) - @test_throws Base.SpecFun.AmosException besselix(-1, 0) - @test_throws Base.SpecFun.AmosException besseljx(-1, 0) - @test_throws Base.SpecFun.AmosException besselyx(1, 0) + @test_throws Base.SpecialFunctions.AmosException hankelh1x(1, 0) + @test_throws Base.SpecialFunctions.AmosException hankelh2x(1, 0) + @test_throws Base.SpecialFunctions.AmosException besselix(-1, 0) + @test_throws Base.SpecialFunctions.AmosException besseljx(-1, 0) + @test_throws Base.SpecialFunctions.AmosException besselyx(1, 0) @test_throws DomainError besselix(0.4,-1.0) @test_throws DomainError besseljx(0.4, -1.0) @test_throws DomainError besselkx(0.4,-1.0) @@ -996,8 +996,8 @@ end end end -@test Base.SpecFun.f32(complex(1.0,1.0)) == complex(Float32(1.),Float32(1.)) -@test Base.SpecFun.f16(complex(1.0,1.0)) == complex(Float16(1.),Float16(1.)) +@test Base.SpecialFunctions.f32(complex(1.0,1.0)) == complex(Float32(1.),Float32(1.)) +@test Base.SpecialFunctions.f16(complex(1.0,1.0)) == complex(Float16(1.),Float16(1.)) # no domain error is thrown for negative values @test invoke(cbrt, Tuple{AbstractFloat}, -1.0) == -1.0