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

intersect on DimUnitRanges returns a Base UnitRange #853

Open
asinghvi17 opened this issue Nov 9, 2024 · 4 comments
Open

intersect on DimUnitRanges returns a Base UnitRange #853

asinghvi17 opened this issue Nov 9, 2024 · 4 comments

Comments

@asinghvi17
Copy link
Collaborator

MWE:

julia> import DimensionalData as DD; using DimensionalData

julia> intersect(DD.Dimensions.DimUnitRange(1:5, X()), DD.Dimensions.DimUnitRange(3:7, X()))
3:5

julia> typeof(ans)
UnitRange{Int64}

Ideally this should return a DimUnitRange. Maybe it could also check that dimensions match. Let me know if this makes sense, and I can PR it.

@rafaqz
Copy link
Owner

rafaqz commented Nov 9, 2024

Probably makes sense

@asinghvi17
Copy link
Collaborator Author

Also, should dims2indices on an extent return a DimUnitRange?

@rafaqz
Copy link
Owner

rafaqz commented Nov 10, 2024

That would mean selectors also returning DimUnitRange.

There's a compilation overhead to doing that.

What would be the benefit?

@rafaqz
Copy link
Owner

rafaqz commented Dec 13, 2024

We will need to use promote_dim on the dimensions to get the right type back.

And also check that the lookup values match after the intersection.

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

No branches or pull requests

2 participants