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 frexp{T<:AbstractFloat}(A::Array{T}) in favor of broadcast ? #19817

Closed
musm opened this issue Jan 2, 2017 · 6 comments
Closed

Deprecate frexp{T<:AbstractFloat}(A::Array{T}) in favor of broadcast ? #19817

musm opened this issue Jan 2, 2017 · 6 comments
Labels
broadcast Applying a function over a collection deprecation This change introduces or involves a deprecation

Comments

@musm
Copy link
Contributor

musm commented Jan 2, 2017

Now that we have . for broadcasting, the method frexp{T<:AbstractFloat}(A::Array{T}) doesn't seem as useful as it once did?

Currently the method returns (F,E) where F is an array of 'significands' and E is an array of 'exponents'. The behavior with the broadcast would instead return an array of tuples.

@ScottPJones also mentioned on gitter that it is also over specified, it only works for Array, not any AbstractArray

@simonbyrne simonbyrne added the broadcast Applying a function over a collection label Jan 3, 2017
@simonbyrne
Copy link
Contributor

Yes, we probably should deprecate it, though as you point out, the fact that there is no way to recreate this functionality via . is a little annoying, which is why I suspect it hasn't been done already.

@JeffBezanson
Copy link
Member

The vectorized version of this is pretty weird. Is there a use case for getting these two arrays of values? Unlike other vectorized functions, returning a tuple of two arrays doesn't compose naturally with most other functions.

@stevengj
Copy link
Member

stevengj commented Jan 3, 2017

If you just want an array of F you could do e.g. first.(frexp.(A))

@stevengj
Copy link
Member

stevengj commented Jan 3, 2017

(I can't find any found one registered packages using frexp, vectorized or not: Compat uses the scalar frexp function in its linspace code. So I doubt that removing the vectorized version will cause too much trouble. The ArbFloats, GSL, Unitful, and Measurement packages define frexp methods, but don't actually use them except in tests.)

@simonbyrne
Copy link
Contributor

simonbyrne commented Jan 4, 2017

I think we just deprecate and say it is no longer available. We don't provide vectorised forms of other 2-output functions (e.g. modf, divmod)

simonbyrne added a commit that referenced this issue Jan 4, 2017
@simonbyrne
Copy link
Contributor

Sorry, I accidentally pushed to master. Fixed by 2e0b001.

@Sacha0 Sacha0 added needs news A NEWS entry is required for this change deprecation This change introduces or involves a deprecation and removed needs news A NEWS entry is required for this change labels May 20, 2017
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 deprecation This change introduces or involves a deprecation
Projects
None yet
Development

No branches or pull requests

5 participants