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 vectorized big methods in favor of compact broadcast syntax #18512

Closed
wants to merge 1 commit into from

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Sep 14, 2016

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 module import rather than export 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!

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))
Copy link
Member

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?

Copy link
Member Author

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,)
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely. I anticipate removing this block altogether when rebasing with #18495 in (or removing the corresponding block from #18495 when rebasing #18495 with this PR in, whichever occurs).

@ararslan
Copy link
Member

You always do such great work, Sacha!

@Sacha0
Copy link
Member Author

Sacha0 commented Sep 14, 2016

Thanks for the kind words @ararslan! 😊

@kshyatt kshyatt added the broadcast Applying a function over a collection label Sep 15, 2016
@@ -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)
Copy link
Contributor

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

Copy link
Member Author

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 :).

@Sacha0
Copy link
Member Author

Sacha0 commented Dec 24, 2016

Rebased. (This PR still contains aliasing broadcast specializations of big. In #18495, consensus (?) formed around removing those specializations in favor of writing e.g. convert(AbstractArray{Big(Int|Float)}, ...). Will remove. Removed.) Best!

@Sacha0
Copy link
Member Author

Sacha0 commented Dec 31, 2016

Subsumed by #19791.

@Sacha0 Sacha0 closed this Dec 31, 2016
@Sacha0 Sacha0 deleted the devecbig branch December 31, 2016 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broadcast Applying a function over a collection
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants