-
Notifications
You must be signed in to change notification settings - Fork 43
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
Repeated use of a dimension #46
Comments
Yes that is currently undefined behaviour. Dimensions are found independently so they don't know about each other, so the first one is found both times. We would have to rethink how The major conceptual change you are asking for is to have a syntax where written dimension order actually matters. Currently Does that make sense? |
I think so, though I can't say I'm 100% on the different type names yet 😄
When I came across this, I wasn't aware this syntax already exists the non-dim-wrapper syntax. When I hit errors with that, I assumed the issue was the repeated dimensions. It turns out that Selectors can't be mixed with positional indexing and all axes have to be specified. This makes having a syntax for filtering on all matching dimensions make sense, but the result for I'm not sure I think that it makes sense to overload |
Because selectors are positional and dimensions aren't. If you wrap the selectors in dimensions, you don't need the positions because the dims will sort them automatically then unwrap, and missing dims will be filled with
I see you point, but that ship has sailed unfortunately! This is also what AxisArrays and most similar packages do, so there is a strong precedent for using I would like to get rid of the Edit: this method. I'm not sure when I will have time, so have a go if you want https://github.com/rafaqz/DimensionalData.jl/blob/master/src/primitives.jl#L26-L51 |
Don't worry about having a go this, it's mostly done. |
For context, I would like to be able to have labelled arrays which represent pairwise measures. These measures can be distances, or they could be adjacency matrices for some network structure.
For these pairwise measures, I think it makes sense for the resulting array to use the same dimension twice. As an example:
Subsetting by dimension results in both axes being subset:
If I try to look at the distance between 10 and 20, I get the wrong result (both axes are being indexed by the first indexer):
For my work, there would be a lot of value in being able to use a dimension multiple times for one array, and being able to apply different selections to those indices. However I'm not sure how this can be resolved without losing the "order of indices doesn't matter" feature here.
Can these be reconciled? If not, I don't think it'd that large of a restriction to make order matter when indices are repeated, or just in general. Having the order be important makes the performance implications of the code be more explicit.
Using the order of the selectors to specify axis does is a workaround when dimensions are repeated:
As an aside, this took me a little bit to find out, as I expected this to work initially:
The text was updated successfully, but these errors were encountered: