-
Notifications
You must be signed in to change notification settings - Fork 586
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
Refactoring to add hyperslab selection to define an indexer #392
Refactoring to add hyperslab selection to define an indexer #392
Conversation
67c9021
to
34dd82b
Compare
…lass `CustomStridesIndex` to keep the previous logic. Add also `DefaultIndex`
34dd82b
to
a4728e7
Compare
… the same backing array/buffer/pointer
a4728e7
to
8b9ca61
Compare
This is looking good, thanks! Do we need to deprecate everything with |
I think customizing the strides is kind of advanced, that's why I thought better not to make it "easy" with a Actually I agree on merging Moreover I'm not 100% sure we actually want to have a getter for the physical strides (it is there only for backward compatibility): what would them be needed for in case of an |
…. HyperslabIndex now extends StrideIndex
I see, yes, I think we can do it that way. That is, consider only
It's something we can add later if we need it, but anyway for sure it won't be part of the One more thing, let's move the factory methods to public static Index create(long... sizes) {
return new StrideIndex(sizes);
}
public static Index create(long[] sizes, long[] strides) {
return new StrideIndex(sizes, strides);
}
public static Index create(long[] sizes, long[] offsets, long[] hstrides, long[] counts, long[] blocks) {
return new HyperslabIndex(sizes, offsets, hstrides, counts, blocks);
} And maybe change it to an |
….strides() (package private) only for backward compatibility, because we need to return strides() in Indexer.
OK applies all suggestions, but we need |
Thanks! Yeah, I'm not too sure what I want to do with those... In any case, we don't need to create new methods that are also deprecated, that's not helpful. For example, we can remove
BTW, we can remove anything we don't need that is |
…x.strides(), add Index.ONE as single dimension index of size one, remove Indexer.ONE_STRIDE
We could even optimize the dummy index by creating a new |
I'm not sure I follow you: when providing different |
Ah, yes, we wouldn't be able to use a singleton. In any case, the optimization would consist in having that class support only 1 size, so it doesn't need to have any strides or do any multiplications. |
…o we save some multiplications
…er-to-allow-an-hyper-rectangular-selection
Let me know what you think of the changes I've just pushed: I made a few more things public (why not?), and "undeprecated" the factory methods in the subclasses of |
Yes, I like them: I see all concepts are more consistent now and thanks for taking care of Javadocs as well! |
Awesome! Are we good to merge this? |
Yup! Just wanted to add a test for |
@saudet I've been using the latest master version and I think we should add a method to get the actual shape of the |
Actually the |
Ops, it is always me: same person using personal/work account ;-) |
If that's the maximum values of the indices, then that sounds like what
"sizes" should be, and so what gets passed to the constructor is something
else.
|
You are talking about the Then it seems natural |
Then, yes, we'll need that.
|
I added a few other commits here: I should have creates a new PR instead, I guess? |
I think we can open a new PR from the same branch, but yes this one has already been merged. |
Also please stop referencing issues in all your commits. They pollute GitHub's interface. |
Current strides are really underlying strides using just
sizes
to calculate them.Adding hyperslab selection parameters: starts, strides, counts, blocks as defined in H5S_SELECT_HYPERSLAB.