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

Basic support for axis simplification and arbitrary order in iterators #979

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

bluss
Copy link
Member

@bluss bluss commented Apr 11, 2021

  • In some cases we can modify the iterator without changing produced element order - for example changing shape [10, 1] to shape [1, 10]
  • In some cases we can merge axes without changing visible element order. Iterating shape [2, 5, 3] as if it is shape [1, 1, 30], if the strides allow
  • In some cases we want to use arbitrary order (here it becomes the in-memory order)
  • In some cases we don't want to change anything (standard order indexed iterator)

Current state of the PR: groundwork, not actually used in any iterator

@bluss bluss force-pushed the iterator-order branch 4 times, most recently from e5224a5 to 49bf28a Compare April 12, 2021 20:42
@bluss bluss force-pushed the iterator-order branch 3 times, most recently from 08068a8 to 2d6bcde Compare May 5, 2021 16:00
@bluss bluss marked this pull request as ready for review May 5, 2021 16:16
@bluss bluss modified the milestones: 0.15.2, 0.15.3 May 10, 2021
@bluss bluss modified the milestones: 0.15.3, 0.16.0 Jun 5, 2021
These `pub` here actually predate the pub(crate) feature, and they
should just be `pub(crate)` or lower since they are unreachable outside
the crate.
This is special for arrays of shape 1 x n or n x 1; add iterator and
iterator sum (fold) benchmarks.
Implement axis merging - this preserves order of elements in the
iteration but might simplify iteration. For example, in a contiguous
matrix, a shape like [3, 4] can be merged into [1, 12].

Also allow arbitrary order optimization - we then try to iterate in
memory order by sorting all axes, currently.
This one complains about if let Some(_) = option; which I still think is
just as fine as if option.is_some(); `if let` is a nice Rust feature
that works the same way on all enums, no reason to prefer
option-specific methods like `is_some`.
@bluss bluss modified the milestones: 0.16.0, 0.17.0 Apr 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