Skip to content
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

Make axes(A) return KeyedUnitRanges? #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Make axes(A) return KeyedUnitRanges? #6

wants to merge 3 commits into from

Conversation

mcabbott
Copy link
Owner

@mcabbott mcabbott commented Mar 14, 2020

This alters axes(A) to return objects very similar to KeyedArrays, each containing both the parent's axes(A,d) and the wrapper's axiskeys(A,d). This is essentially the behaviour of https://github.com/tokazama/AxisIndices.jl, I think.

The returned type needs to be <: AbstractUnitRange so can't inherit, but many methods can be defined on a new KeyedUnion.

The reason to do this is that many functions which call similar(A, ..., axes(A,3), ...) could automatically propagate keys. The downside is that many functions also specialise on Base.OneTo(n), so for example this tends to make lots of unnecessary OffsetArrays. I don't think that's true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant