Construction from negative strides?

Aperta
#842 3 commenti 2 reazioni 0 assegnatari Vedi su GitHub

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
Da chiarire
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
data

Direzione di ricerca

Start with the linked PyO3/rust-numpy issue for the full context, then inspect the referenced ndarray src/impl_raw_views.rs debug assertion. Determine whether negative-stride construction should have a public unsafe API and why strides are represented as usize; done requires a decided, documented API direction rather than only a local workaround.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi, thank you for this great library.

I encountered a problem when creating an ArrayView with a pointer and negative strides (see https://github.com/PyO3/rust-numpy/issues/151 for the full context).
We can do this by converting &[isize] to &[usize], but this causes panic by a debug assertion when building without --release flag.
So,

  • How about adding some unsafe API to do this? It would be like a public new_. I'm happy to create a PR if you're willing to.
  • Why are strides internally usize? It can be negative by slicing and I don't think it's reasonable to use usize.
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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-ndarray/ndarray

Tutte le issue di rust-ndarray/ndarray

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.