-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: variadic mapslices #23306
Comments
My only problem with this is the argument order; typically the dimensions come after the array. This would make |
Does Julia have any other variadic functions which take dimensions? I think passing in a tuple of arrays would be worse but that's the only alternative I can think of, short of a monstrous generated function. |
or kwargs for dimensions, which I think a few people would like us to move towards more generally if keyword performance can be fixed soon |
That would prevent e.g. AxisArrays from dispatching on the type of |
Currently. Keywords based on NamedTuples might fix that though. cc @JeffBezanson – is that a possibility? |
We may be closing in on a fast inferrable variant of CC @Cody-G |
There's a package JuliennedArrays which is clever both in its naming and design. It provides arbitrary slice iterators and also turns Cross-reference #14491. |
There has been some discussion about variadic and dyadic
mapslices
, such as in #5140 and issues linked therein, as well as on the Julia Slack starting here.Approaches specifying dims for both arrays have so far been unsuccessful. However, given the abundant functionality for transforming array shapes, I believe a
mapslices
which only specified one set of dims for all arrays could still be useful.I propose:
Phase 1 (pre-1.0)
mapslices(f, dims::Tuple, As::A...) where {N,A<:(AbstractArray{T,N} where T)}
which returns a single arraymapslices(f, A::AbstractArray, dims::Tuple)
tomapslices(f, dims, A)
Phase 2 (optionally post-1.0)
eachslice(A, dims)
IteratorsMD functionmapslices
in terms ofeachslice
Unless there are serious concerns I can implement a PR for phase 1.
The text was updated successfully, but these errors were encountered: