Skip to content

Commit

Permalink
Deprecate manually vectorized methods for trigonometric and hyperboli…
Browse files Browse the repository at this point in the history
…c functions in favor of compact broadcast syntax.
  • Loading branch information
Sacha0 committed Dec 24, 2016
1 parent 44d7677 commit 789124c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 8 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ macro vectorize_2arg(S,f)
end
export @vectorize_1arg, @vectorize_2arg

<<<<<<< HEAD
# deprecations for uses of old dot operators (.* etc) as objects, rather than
# just calling them infix.
for op in (:(!=), :, :+, :-, :*, :/, :÷, :%, :<, :(<=), :, :(==), :>, :>=, :, :\, :^, ://, :>>, :<<)
Expand Down Expand Up @@ -1168,4 +1169,11 @@ for (dep, f, op) in [(:sumabs!, :sum!, :abs),
end
end

# Deprecate manually vectorized trigonometric and hyperbolic functions in favor of compact broadcast syntax
for f in (:sec, :sech, :secd, :asec, :asech,
:csc, :csch, :cscd, :acsc, :acsch,
:cot, :coth, :cotd, :acot, :acoth)
@eval @deprecate $f{T<:Number}(A::AbstractArray{T}) $f.(A)
end

# End deprecations scheduled for 0.6
3 changes: 0 additions & 3 deletions base/special/trig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ for (finv, f) in ((:sec, :cos), (:csc, :sin), (:cot, :tan),
(:secd, :cosd), (:cscd, :sind), (:cotd, :tand))
@eval begin
($finv){T<:Number}(z::T) = one(T) / (($f)(z))
($finv){T<:Number}(z::AbstractArray{T}) = one(T) ./ (($f)(z))
end
end

Expand All @@ -324,11 +323,9 @@ for (tfa, tfainv, hfa, hfainv, fn) in ((:asec, :acos, :asech, :acosh, "secant"),
@doc """
$($tname)(x)
Compute the inverse $($fn) of `x`, where the output is in radians. """ ($tfa){T<:Number}(y::T) = ($tfainv)(one(T) / y)
($tfa){T<:Number}(y::AbstractArray{T}) = ($tfainv)(one(T) ./ y)
@doc """
$($hname)(x)
Compute the inverse hyperbolic $($fn) of `x`. """ ($hfa){T<:Number}(y::T) = ($hfainv)(one(T) / y)
($hfa){T<:Number}(y::AbstractArray{T}) = ($hfainv)(one(T) ./ y)
end
end

Expand Down

0 comments on commit 789124c

Please sign in to comment.