Skip to content

Added getindex and view for UniqueSortIndex with a UnitRange #11

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

Merged
merged 2 commits into from
May 30, 2020

Conversation

kcajf
Copy link
Contributor

@kcajf kcajf commented May 9, 2020

Implements indexing of a straightforwardly ordered UniqueSortIndex with a UnitRange. This is the case that comes up almost 100% of the time for me (usually taking a positive-step slice of an array indexed with some unique, increasing Dates).

I also looked at implementing for SortIndex, but was thrown off by the n_unique so left it for now.

The construction of the return AAs would also be made simpler if #10 merges.

I added some notes at the bottom for further TODOs. StepRanges are annoying because they retain sortedness depending on the sign of their step.

Copy link
Owner

@andyferris andyferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent. I've been wanting these (and more) for ages - thanks.

We should use the @propagate_inbounds macro here to reduce work done when we know the unit range is valid.

@andyferris
Copy link
Owner

In the future, the nice one will be indexing a sorted array with a sorted array :)

Copy link
Owner

@andyferris andyferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I made a few changes, should be good.

@andyferris andyferris merged commit db749b4 into andyferris:master May 30, 2020
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.

2 participants