Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate functions vectorized via @vectorize_(1|2)arg in favor of compact broadcast syntax #17302

Merged
merged 18 commits into from
Sep 4, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3307a5e
Deprecate vectorized functions in base/special/trig.jl in favor of co…
Sacha0 Jul 5, 2016
1eb5a31
Deprecate vectorized functions in base/special/log.jl in favor of com…
Sacha0 Jul 5, 2016
b0f4e94
Deprecate vectorized functions in base/special/gamma.jl in favor of c…
Sacha0 Jul 5, 2016
15234b4
Deprecate vectorized functions in base/special/erf.jl in favor of com…
Sacha0 Jul 5, 2016
7003a9d
Deprecate vectorized functions in base/special/bessel.jl in favor of …
Sacha0 Jul 5, 2016
898c512
Deprecate vectorized functions in base/math.jl in favor of compact br…
Sacha0 Jul 5, 2016
2a5b38d
Deprecate vectorized functions in base/floatfuncs.jl in favor of comp…
Sacha0 Jul 5, 2016
d5a9830
Deprecate vectorized functions in base/fastmath.jl in favor of compac…
Sacha0 Jul 5, 2016
edb235a
Deprecate vectorized functions in base/complex.jl in favor of compact…
Sacha0 Jul 5, 2016
a745a8e
Deprecate vectorized functions in base/dates/accessors.jl in favor of…
Sacha0 Jul 6, 2016
68a746b
Deprecate vectorized functions in base/dates/adjusters.jl in favor of…
Sacha0 Jul 6, 2016
8dc9725
Deprecate vectorized functions in base/dates/conversions.jl in favor …
Sacha0 Jul 6, 2016
253c5de
Deprecate vectorized functions in base/dates/query.jl in favor of com…
Sacha0 Jul 6, 2016
4df8f20
Clean up @vectorize_(1|2)arg deprecations.
Sacha0 Jul 8, 2016
8258554
Deprecate `@vectorize_1arg` and `@vectorize_2arg`.
Sacha0 Aug 13, 2016
bb88931
Update documentation following deprecation of macro-vectorized functi…
Sacha0 Aug 13, 2016
2c5fa85
Revise a few vectorized-math methods, specifically eliminating tempor…
Sacha0 Aug 31, 2016
b0e7481
Remove now-redundant integer-specialized condskeel methods.
Sacha0 Aug 31, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up @vectorize_(1|2)arg deprecations.
  • Loading branch information
Sacha0 committed Sep 4, 2016
commit 4df8f20a93902dbe6d142a8c16a4f0e644a5dd5f
67 changes: 47 additions & 20 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,6 @@ end
macro dep_vectorize_2arg(S, f)
S = esc(S)
f = esc(f)
T1 = esc(:T1)
T2 = esc(:T2)
quote
@deprecate $f{T<:$S}(x::$S, y::AbstractArray{T}) $f.(x,y)
@deprecate $f{T<:$S}(x::AbstractArray{T}, y::$S) $f.(x,y)
Expand All @@ -883,35 +881,58 @@ end

# Deprecate @vectorize_1arg-vectorized functions from...
for f in (
:sinpi, :cospi, :sinc, :cosc, # base/special/trig.jl
:log, :log1p, # base/special/log.jl
:gamma, :lfact, :digamma, :trigamma, :zeta, :eta,# base/special/gamma.jl
:erfcx, :erfi, :dawson, # base/special/erf.jl
:airyprime, :airyai, :airyaiprime, :airybi, :airybiprime, :airy, :airyx, :besselj0, :besselj1, :bessely0, :bessely1, # base/special/bessel.jl
:cbrt, :sinh, :cosh, :tanh, :atan, :asinh, :exp, :erf, :erfc, :exp2, :expm1, :exp10, :sin, :cos, :tan, :asin, :acos, :acosh, :atanh, #=:log,=# :log2, :log10, :lgamma, #=:log1p,=# :sqrt, # base/math.jl
:abs, :abs2, :angle, :isnan, :isinf, :isfinite, # base/floatfuncs.jl
:acos_fast, :acosh_fast, :angle_fast, :asin_fast, :asinh_fast, :atan_fast, :atanh_fast, :cbrt_fast, :cis_fast, :cos_fast, :cosh_fast, :exp10_fast, :exp2_fast, :exp_fast, :expm1_fast, :lgamma_fast, :log10_fast, :log1p_fast, :log2_fast, :log_fast, :sin_fast, :sinh_fast, :sqrt_fast, :tan_fast, :tanh_fast, # base/fastmath.jl
:cis, # base/complex.jl
# base/special/trig.jl
:sinpi, :cospi, :sinc, :cosc,
# base/special/log.jl
:log, :log1p,
# base/special/gamma.jl
:gamma, :lfact, :digamma, :trigamma, :zeta, :eta,
# base/special/erf.jl
:erfcx, :erfi, :dawson,
# base/special/bessel.jl
:airyprime, :airyai, :airyaiprime, :airybi, :airybiprime,
:airy, :airyx, :besselj0, :besselj1, :bessely0, :bessely1,
# base/math.jl
:cbrt, :sinh, :cosh, :tanh, :atan, :asinh, :exp, :erf, :erfc, :exp2,
:expm1, :exp10, :sin, :cos, :tan, :asin, :acos, :acosh, :atanh,
#=:log,=# :log2, :log10, :lgamma, #=:log1p,=# :sqrt,
# base/floatfuncs.jl
:abs, :abs2, :angle, :isnan, :isinf, :isfinite,
# base/fastmath.jl
:acos_fast, :acosh_fast, :angle_fast, :asin_fast, :asinh_fast,
:atan_fast, :atanh_fast, :cbrt_fast, :cis_fast, :cos_fast,
:cosh_fast, :exp10_fast, :exp2_fast, :exp_fast, :expm1_fast,
:lgamma_fast, :log10_fast, :log1p_fast, :log2_fast, :log_fast,
:sin_fast, :sinh_fast, :sqrt_fast, :tan_fast, :tanh_fast,
# base/complex.jl
:cis,
)
@eval @dep_vectorize_1arg Number $f
end
for f in (
:sind, :cosd, :tand, :asind, :acosd, :atand, :asecd, :acscd, :acotd, # base/special/trig.jl
:invdigamma, # base/special/gamma.jl
:erfinc, :erfcinv, # base/special/erf.jl
:rad2deg, :deg2rad, :exponent, :significand, # base/math.jl
:trunc, :floor, :ceil, :round, # base/floatfuncs.jl
:rad2deg, :deg2rad, :exponent, :significand, # base/math.jl
:unix2datetime, :rata2datetime, :julian2datetime, # base/dates/conversions.jl
:sind, :cosd, :tand, :asind, :acosd, :atand, :asecd, :acscd, :acotd, # base/special/trig.jl
)
@eval @dep_vectorize_1arg Real $f
end
# base/complex.jl
@dep_vectorize_1arg Complex round
@dep_vectorize_1arg Complex float
for f in (
:year, :month, :day, :week, :dayofmonth, :yearmonth, :monthday, :yearmonthday, # base/dates/accessors.jl
:firstdayofweek, :lastdayofweek, :firstdayofmonth, :lastdayofmonth, :firstdayofyear, :lastdayofyear, :firstdayofquarter, :lastdayofquarter, # base/dates/adjusters.jl
:dayname, :dayabbr, :dayofweek, :dayofweekofmonth, :daysofweekinmonth, :monthname, :monthabbr, :daysinmonth, :isleapyear, :dayofyear, :daysinyear, :quarterofyear, :dayofquarter, # base/dates/query.jl
# base/dates/accessors.jl
:year, :month, :day, :week, :dayofmonth, :yearmonth, :monthday, :yearmonthday,
# base/dates/adjusters.jl
:firstdayofweek, :lastdayofweek, :firstdayofmonth,
:lastdayofmonth, :firstdayofyear, :lastdayofyear,
:firstdayofquarter, :lastdayofquarter,
# base/dates/query.jl
:dayname, :dayabbr, :dayofweek, :dayofweekofmonth,
:daysofweekinmonth, :monthname, :monthabbr, :daysinmonth,
:isleapyear, :dayofyear, :daysinyear, :quarterofyear, :dayofquarter,
)
@eval @dep_vectorize_1arg Dates.TimeType $f
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this depends on #16966 — i.e. we need broadcast to recognize TimeType as a "scalar".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, no, I guess it will work as-is for operations on Array{TimeType} by themselves.

end
Expand All @@ -925,10 +946,16 @@ end

# Deprecate @vectorize_2arg-vectorized functions from...
for f in (
:polygamma, :zeta, :beta, :lbeta, # base/special/gamma.jl
:airy, :airyx, :besseli, :besselix, :besselj, :besseljx, :besselk, :besselkx, :bessely, :besselyx, :besselh, :besselhx, :hankelh1, :hankelh2, :hankelh1x, :hankelh2x, # base/special/bessel.jl
:log, :hypot, :atan2, # base/math.jl
:pow_fast, :atan2_fast, :hypot_fast, :max_fast, :min_fast, :minmax_fast, # base/fastmath.jl
# base/special/gamma.jl
:polygamma, :zeta, :beta, :lbeta,
# base/special/bessel.jl
:airy, :airyx, :besseli, :besselix, :besselj, :besseljx,
:besselk, :besselkx, :bessely, :besselyx, :besselh,
:besselhx, :hankelh1, :hankelh2, :hankelh1x, :hankelh2x,
# base/math.jl
:log, :hypot, :atan2,
# base/fastmath.jl
:pow_fast, :atan2_fast, :hypot_fast, :max_fast, :min_fast, :minmax_fast,
)
@eval @dep_vectorize_2arg Number $f
end
Expand Down
17 changes: 2 additions & 15 deletions test/sparsedir/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ let
@test I == imag.(S)
@test real.(sparse(R)) == R
@test nnz(imag.(sparse(R))) == 0
@test abs.(S) == abs(D)
@test abs2.(S) == abs2(D)
@test abs.(S) == abs.(D)
@test abs2.(S) == abs2.(D)
end
end

Expand Down Expand Up @@ -1063,19 +1063,6 @@ end
x = speye(100)
@test_throws BoundsError x[-10:10]

for T in (Int, Float16, Float32, Float64, BigInt, BigFloat)
let R=rand(T[1:100;],2,2), I=rand(T[1:100;],2,2)
D = R + I*im
S = sparse(D)
@test R == real.(S)
@test I == imag.(S)
@test real.(sparse(R)) == R
@test nnz(imag.(sparse(R))) == 0
@test abs.(S) == abs.(D)
@test abs2.(S) == abs2.(D)
end
end

# issue #10407
@test maximum(spzeros(5, 5)) == 0.0
@test minimum(spzeros(5, 5)) == 0.0
Expand Down