-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
Ability to map a function to slices of a KeyedArray including the dimension index names of each slice.
Proposed syntax below passes the slice and index names as a named tuple.
function my_func( (; slice, I, X ) )
"$I $X $(slice(:a))"
end
K = KeyedArray( [1;2;;3;4;;;5;6;;7;8], A=[:a,:b], I=[:i,:j], X=[:x,:y] )
# proposed syntax
mapslices( my_func, K; dims=(:A) )
#would give the same result as
@tullio Z[i,x] := my_func( (; slice=K[:,i,x], I=K.I[i], X=K.X[x]) )
KeyedArray( Z, I=K.I, X=K.X)
Metadata
Metadata
Assignees
Labels
No labels