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

Add shape::, array_ref::, and array::bounds() #105

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

fbleibel-g
Copy link
Collaborator

No description provided.

Helps avoid the common mistake of creating an array from an existing
argument's shape, inheriting the strides and possibly violating
compile-time constraints. (e.g. creating a planar image from an
interleaved image's shape).
@fbleibel-g fbleibel-g marked this pull request as ready for review August 5, 2024 16:59
@dsharlet
Copy link
Owner

dsharlet commented Aug 5, 2024

How does this relate to #83? This looks similar to a suggestion I made there:

What if we just have a helper that drops all strides from shape? And maybe also try to make shapes easier to work with if you don't care about strides (if that's even an issue now)? array/array_ref could have a helper function bounds() that just returns the shape with all strides removed.

#83 (review)

I haven't been that happy with anything along these lines, but after so many years we should just go with what you have here.

@fbleibel-g
Copy link
Collaborator Author

This looks just like what you suggested. We also discussed this on Chat a while back and I think bounds() was the winner for this particular problem. If you don't have any objections then, I'll merge this in.

@dsharlet dsharlet merged commit e1525b0 into dsharlet:master Aug 6, 2024
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