-
-
Couldn't load subscription status.
- Fork 5.7k
Closed
Description
The eachindex is a great function, which provides a uniform & efficient way to traverse a array.
However, in many cases, the computation require multiple arguments, e.g., addition.
s = rand(5, 6)
a = rand(4, 6) # with fast linear indexing
b = sub(s, 1:4, :) # no fast linear indexing
c = zeros(4, 6)
# It would be great to do the following
for (ia, ib, ic) in eachindex(a, b, c)
c[ic] = a[ia] + b[ib]
endA more greedy demand is to allow broadcasting eachindex when arrays have different sizes, but their shapes are compatible (in terms of broadcasting).
cc: @timholy
Metadata
Metadata
Assignees
Labels
No labels