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

type computation in broadcast is worse than in map #16164

Closed
stevengj opened this issue May 2, 2016 · 5 comments
Closed

type computation in broadcast is worse than in map #16164

stevengj opened this issue May 2, 2016 · 5 comments

Comments

@stevengj
Copy link
Member

stevengj commented May 2, 2016

With current 0.5 master:

julia> map(Float32, [3,4,5])
3-element Array{Float32,1}:
 3.0
 4.0
 5.0

julia> broadcast(Float32, [3,4,5])
3-element Array{Int64,1}:
 3
 4
 5

We presumably want to return a Float32 array in both cases?

cc: @ViralBShah: this affects the case you asked about in #8450, since my f.(x...) implementation in #15032 is equivalent to broadcast.

@stevengj stevengj added the types and dispatch Types, subtyping and method dispatch label May 2, 2016
@GunnarFarneback
Copy link
Contributor

I believe this not really a type inference issue but a type computation issue due to a missing piece in the promote_op machinery.

@JeffBezanson
Copy link
Member

I think broadcast is due for an update now that higher-order functions are fast.

@JeffBezanson JeffBezanson removed the types and dispatch Types, subtyping and method dispatch label May 3, 2016
@stevengj
Copy link
Member Author

stevengj commented May 4, 2016

Another instance of the same problem: broadcast(sin, 3) throws an InexactError.

@stevengj stevengj changed the title type inference in broadcast is worse than in map type computation in broadcast is worse than in map May 4, 2016
timholy pushed a commit that referenced this issue May 4, 2016
timholy added a commit that referenced this issue May 4, 2016
@stevengj
Copy link
Member Author

stevengj commented May 5, 2016

See also #11119, #12277.

@stevengj
Copy link
Member Author

stevengj commented May 5, 2016

Duplicate of #4883. (Yes, I duplicated my own issue. Sigh.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants