11module ColorVectorSpace
22
3- using ColorTypes, FixedPointNumbers, SpecialFunctions
3+ using ColorTypes, FixedPointNumbers
44using TensorCore
55import TensorCore: ⊙ , ⊗
66
@@ -11,7 +11,7 @@ import Base: abs, clamp, convert, copy, div, eps, float,
1111 isfinite, isinf, isnan, isless, length, mapreduce, oneunit,
1212 promote_op, promote_rule, zero, trunc, floor, round, ceil, bswap,
1313 mod, mod1, rem, atan, hypot, max, min, real, typemin, typemax
14- # More unaryOps (mostly math functions)
14+ # More unaryops (mostly math functions)
1515import Base: conj, sin, cos, tan, sinh, cosh, tanh,
1616 asin, acos, atan, asinh, acosh, atanh,
1717 sec, csc, cot, asec, acsc, acot,
@@ -23,7 +23,6 @@ import Base: conj, sin, cos, tan, sinh, cosh, tanh,
2323 exp2, exp10, expm1, cbrt, sqrt,
2424 significand, frexp, modf
2525import LinearAlgebra: norm, ⋅ , dot, promote_leaf_eltypes # norm1, norm2, normInf
26- import SpecialFunctions: gamma, logabsgamma, lfact
2726using Statistics
2827import Statistics: middle # and `_mean_promote`
2928
@@ -293,7 +292,7 @@ dotc(x::T, y::T) where {T<:AbstractRGB} = 0.200f0 * acc(red(x))*acc(red(y)) + 0.
293292dotc (x:: AbstractRGB , y:: AbstractRGB ) = dotc (promote (x, y)... )
294293
295294# Scalar Gray
296- const unaryOps = (:~ , :conj , :abs ,
295+ const unaryops = (:~ , :conj , :abs ,
297296 :sin , :cos , :tan , :sinh , :cosh , :tanh ,
298297 :asin , :acos , :atan , :asinh , :acosh , :atanh ,
299298 :sec , :csc , :cot , :asec , :acsc , :acot ,
@@ -303,21 +302,10 @@ const unaryOps = (:~, :conj, :abs,
303302 :asind , :atand , :rad2deg , :deg2rad ,
304303 :log , :log2 , :log10 , :log1p , :exponent , :exp ,
305304 :exp2 , :exp10 , :expm1 , :cbrt , :sqrt ,
306- :significand ,
307- :gamma , :lfact , :frexp , :modf ,
308- :(SpecialFunctions. erf), :(SpecialFunctions. erfc),
309- :(SpecialFunctions. erfcx), :(SpecialFunctions. erfi), :(SpecialFunctions. dawson),
310- :(SpecialFunctions. airyai),
311- :(SpecialFunctions. airyaiprime), :(SpecialFunctions. airybi), :(SpecialFunctions. airybiprime),
312- :(SpecialFunctions. besselj0), :(SpecialFunctions. besselj1), :(SpecialFunctions. bessely0), :(SpecialFunctions. bessely1),
313- :(SpecialFunctions. eta), :(SpecialFunctions. zeta), :(SpecialFunctions. digamma))
314- for op in unaryOps
305+ :significand , :frexp , :modf )
306+ for op in unaryops
315307 @eval ($ op)(c:: AbstractGray ) = Gray ($ op (gray (c)))
316308end
317- function logabsgamma (c:: AbstractGray )
318- lagc, s = logabsgamma (gray (c))
319- return Gray (lagc), s
320- end
321309
322310middle (c:: AbstractGray ) = arith_colorant_type (c)(middle (gray (c)))
323311middle (x:: C , y:: C ) where {C<: AbstractGray } = arith_colorant_type (C)(middle (gray (x), gray (y)))
@@ -523,6 +511,8 @@ For more information about the transition, see ColorVectorSpace's README.
523511abs2 (c:: Union{Real,AbstractGray,AbstractRGB} ) = c ⋅ c
524512end
525513
514+ isdefined (Base, :get_extension ) || using Requires
515+
526516function __init__ ()
527517 if isdefined (Base, :Experimental ) && isdefined (Base. Experimental, :register_error_hint )
528518 Base. Experimental. register_error_hint (MethodError) do io, exc, argtypes, kwargs
@@ -549,6 +539,9 @@ function __init__()
549539 end
550540 end
551541 end
542+ @static if ! isdefined (Base, :get_extension )
543+ @require SpecialFunctions = " 276daf66-3868-5448-9aa4-cd146d93841b" include (" ../ext/SpecialFunctionsExt.jl" )
544+ end
552545end
553546
554547# # Precompilation
0 commit comments