broadcast!
broadcast!(f, dest, As...)
Like broadcast
, but store the result of broadcast(f, As...)
in the dest
array. Note that dest
is only used to store the result, and does not supply arguments to f
unless it is also listed in the As
, as in broadcast!(f, A, A, B)
to perform A[:] = broadcast(f, A, B)
.
Examples
julia> foo = [1 2]
1x2 Array{Int64,2}:
1 2
julia> bar = [-1; -2]
2x1 Array{Int64,2}:
-1
-2
julia> baz = Array(Int8, (2,2));
julia> broadcast!(*, baz, foo, bar)
-1 -2
-2 -4
See Also
User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.