iterators are confusing
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- data, developer-experience
Direzione di ricerca
Start with the ArrayBase documentation and the axis_iter(), par_iter(), indexed_iter(), IndexedIter, and Zip entry points named in the issue. Review how into_par_iter() and enumerate() are currently exposed, then seek maintainer guidance on which iterator APIs or documentation changes are wanted. Done means an agreed scope is implemented and the relevant iterator behavior and documentation are covered.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The current framework for iteration over arrays is confusing. Issue edited because it's even more confusing than at first glance!
Common scenarios for iteration include:
- Iterating over the elements of an array
- Iterating over subviews along an axis of an array
- Iterating mutably
- Indexed iteration
- Iterating over multiple arrays in lockstep
- Parallel iteration with Rayon
Users may expect some consistent idioms with regard to how these different iterators are accessed. The ArrayBase documentation is the starting point for many users. It is currently non-obvious (at least to me) that:
- We can iterate over subviews along an axis in parallel.
Because there isArrayBase::par_iter()but notArrayBase::par_axis_iter(). - We can have indexed iterators over subview along an axis.
Because there isArrayBase::indexed_iter()but notArrayBase::indexed_axis_iter().
I may be missing it, but it appears there is no currently no way to:
- Get a parallel version of
IndexedIterwithout the overhead ofZip::indexed(). - Get a (non-parallel)
IteratorfromZip.
There are good reasons for some of these idiosyncrasies (e.g. expeditious blanket impls), but they still steepen ndarray's learning curve. Ways to address this would include:
- Adding hints about
into_par_iter()andenumerate()to the documentation forArrayBase::axis_iter().
Or adding corresponding convenience methodsArrayBase::indexed_axis_iter(). - Implementing
IntoParallelIteratorforIndexedIter.
Assuming it can be more efficient thanZip::indexed(). - Implementing
IntoIteratorforZip.
What are the maintainers' views on these ideas? I would be happy to contribute pull requests with some guidance.
- Lingua principale
- Rust
- Stelle
- 4.3k
- Fork
- 391
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rust-ndarray/ndarray
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
rust-ndarray/ndarray#1612 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
rust-ndarray/ndarray#1617 · 1 commento ·
-
Stack overflow in `triu` Apertabug good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
rust-ndarray/ndarray#1615 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
rust-ndarray/ndarray#1610 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
rust-ndarray/ndarray#1609 ·