-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
broadcastApplying a function over a collectionApplying a function over a collectionjulepJulia Enhancement ProposalJulia Enhancement Proposal
Milestone
Description
Now that #15032 is merged, here are the main remaining steps discussed in #8450, roughly in order that they should be implemented:
- Improve output type-computation in
broadcastto be at least as good asmap(broadcast picking incorrect result type #4883). The trickest part is the ongoing discussion of what to do in the empty-array case (see Coherent map and comprehension, the imminent death of type_goto #11034). - Deprecate
@vectorizedfunctions likesin(x)in favor ofsin.(x). Deprecate functions vectorized via@vectorize_(1|2)argin favor of compact broadcast syntax #17302 - Parse operators like
a .+ basbroadcast(+, a, b). (See also support many more Unicode infix operators #6929 (comment), Allow users to define "dot" vectorized operators. #14544, and parse more dot operators, parse .= with assignment precedence #17393.) Existing overloaded functions.+(a, b) = ...can be deprecated in favor of overloadingbroadcast(::typeof(+), a, b). make "dot" operations (.+ etc) fusing broadcasts #17623
More speculative proposals probably for the 0.6 timeframe (suggested by @yuyichao):
- Define nested
f.(args...)calls as "fusing" broadcast operations at the syntax level. For example,sin.(x .+ cos.(x .^ sum(x.^2)))would turn (injulia-syntax.scm) intobroadcast((x, _s_) -> sin(x + cos(x^_s_)), x, sum(broacast(^, x, 2))). Notice that thesumfunction (or any non-dot call) would be a "fusion boundary." The caller would be responsible for not usingf.(args...)in cases where fusion would screw up side effects. fusion of nested f.(args) calls into a single broadcast call #17300 - Define
x .= ...as "fusing" calls tobroadcast!, e.g.x .= sin.(x .+ y)would act in-place with a single loop. Again, this would occur at the syntax level, so the caller would be responsible for avoiding function calls with problematic side effects. (See make .+= et al. mutating LinearAlgebra.jl#119, but the lack of loop fusion at that time made.+=much less attractive.) treat .= as syntactic sugar for broadcast! #17510
diegozea, longqian95, nalimilan, ylxdzsw, pkofod and 16 more
Metadata
Metadata
Assignees
Labels
broadcastApplying a function over a collectionApplying a function over a collectionjulepJulia Enhancement ProposalJulia Enhancement Proposal