Memory order like another array

Aperta
#1,072 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
data

Direzione di ricerca

Start by reading the Array3::from_elem, is_standard_layout(), dim(), clone(), and f() entry points shown in the issue. Trace how array layout is represented and determine the expected behavior for a new array with different dimensions. Done means the intended layout-preserving API is defined, implemented, and tested for both standard and non-standard layouts.

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

Descrizione

enhancement good first issue

One of my function needs to create a new array with the same order as the input. I know I can use clone() when both arrays have the same dimension, but when it's not the case, it's more complex.

fn binary_dilation(mask: &Array3<bool>) -> Array3<bool> {
    let (width, height, depth) = mask.dim();
    let dim = (width + etc., ...);
    let mut new_mask = if mask.is_standard_layout() {
        Array3::from_elem(dim, false)
    } else {
        Array3::from_elem(dim.f(), false)
    };
    // Do something
}

Is there a one-liner for this? Something like

Array3::from_elem(dim.order_of(mask), false)

or anytning that doesn't require an if?

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.