-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 vectorized big methods in favor of compact broadcast syntax #18512
Conversation
broadcast(::typeof(big), r::StepRange) = big(r.start):big(r.step):big(last(r)) | ||
broadcast(::typeof(big), r::FloatRange) = FloatRange(big(r.start), big(r.step), r.len, big(r.divisor)) | ||
function broadcast(::typeof(big), r::LinSpace) | ||
big(r.len) == r.len || error(string(r, ": too long for ", big)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better as an ArgumentError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Changing here and in #18495. Thanks!
@@ -541,7 +541,7 @@ function float{T}(A::AbstractArray{T}) | |||
convert(AbstractArray{typeof(float(zero(T)))}, A) | |||
end | |||
|
|||
for fn in (:float,:big) | |||
for fn in (:float,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably just deloopify this since it's iterating over a single value, or so I would assume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You always do such great work, Sacha! |
Thanks for the kind words @ararslan! 😊 |
@@ -828,8 +828,8 @@ function complex{T}(A::AbstractArray{T}) | |||
convert(AbstractArray{typeof(complex(zero(T)))}, A) | |||
end | |||
|
|||
big{T<:Integer,N}(A::AbstractArray{Complex{T},N}) = convert(AbstractArray{Complex{BigInt},N}, A) | |||
big{T<:AbstractFloat,N}(A::AbstractArray{Complex{T},N}) = convert(AbstractArray{Complex{BigFloat},N}, A) | |||
broadcast{T<:Integer,N}(::typeof(big), A::AbstractArray{Complex{T},N}) = convert(AbstractArray{Complex{BigInt},N}, A) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could possibly document that broadcast
can alias, like we do for convert
. #17519
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref. ongoing discussion in #18495, and particularly #18495 (comment). Agreed, that is :).
Rebased. ( |
Subsumed by #19791. |
This PR deprecates all (?) remaining vectorized
big
methods in favor of compact broadcast syntax. Ref. #16285, #17302, and #18495.As with #18495, to work around #18462 I made the
Broadcast
moduleimport
rather thanexport
broadcast
. I will correct this if / when a better solution for #18462 appears.I imagine #17302 was a bit of a bear to review. So for devectorization of manually vectorized functions, I'm shooting for small, atomic PRs with the hope that that will ease review. If instead I should bundle them, please let me know! Best!