Memory order like another array

Abierto
#1,072 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust
Área
data

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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?

Lenguaje dominante
Rust
Estrellas
4.3k
Forks
391
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-ndarray/ndarray

Todos los issues de rust-ndarray/ndarray

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.