broadcast
broadcast(f, As...)
Broadcasts the arrays As
to a common size by expanding singleton dimensions, and returns an array of the results f(as...)
for each position.
Examples
julia> foo = [1 2]
1x2 Array{Int64,2}:
1 2
julia> bar = [10; 9]
2x1 Array{Int64,2}:
10
9
julia> broadcast(+, foo, bar) # equivalent to foo .+ bar
11 12
10 11
julia> broadcast((x,y) -> x^y, bar, foo)
10 100
9 81
See Also
Array, broadcast, cat, combinations, conj!, digits!, fieldnames, fill, fill!, last, length, maximum, minimum, ones, parent, parentindexes, partitions, permutations, pointer, pointer_to_array, promote_shape, rand!, reshape, scale, similar, sum, sum_kbn, takebuf_array, transpose!, vec, zeros,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.