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

Fix indexing of DimStacks with nested DimArrays #892

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

tiemvanderdeure
Copy link
Collaborator

Solves #891

The logic here is that if getindex returns the eltype of a stack, then it should return a NamedTuple. This should be more robust then checking if any of the returned objects are DimArrays.

I've tried with a few DimStacks and don't see any difference in performance - but we might want to test a bit more rigorously?

Copy link
Owner

@rafaqz rafaqz left a comment

Choose a reason for hiding this comment

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

That does seem more correct

What's up with the docs?

@tiemvanderdeure
Copy link
Collaborator Author

tiemvanderdeure commented Jan 7, 2025

I don't know about the docs, but it seems unrelated because there aren't any stacks in those examples?

Also it's some trivial whitespace thing I think

@tiemvanderdeure
Copy link
Collaborator Author

I realized an alternative way to do this is just to test whether or not all(hasdim(D, dims(s))) && all(map(d -> d isa Dimension{<:Integer}, D)). That might be a bit easier on the compiler?

@rafaqz
Copy link
Owner

rafaqz commented Jan 7, 2025

I think I like the current way better. But either way it would be nice to have a test of the edge cases this fixes

@rafaqz rafaqz merged commit 052a602 into rafaqz:main Jan 8, 2025
6 of 8 checks passed
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