How to make zip work with more than 6 elements?

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

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start with the Zip::from, .and, and .for_each entry points and the compiler example at src/main.rs:47. Review how support for the existing producer counts is organized, then verify that the seven-producer example compiles and executes with the expected values.

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

Descrizione

I want to use zip (or azip!) with 7 producers but its only implemented for max 6 producers. Is there a convenient way to also implement it for more producers?

Minimal Example Code:

let v1: Array1<i32> = Array1::zeros(3);
let v2: Array1<i32> = Array1::zeros(3);
let v3: Array1<i32> = Array1::zeros(3);
let v4: Array1<i32> = Array1::zeros(3);
let v5: Array1<i32> = Array1::zeros(3);
let v6: Array1<i32> = Array1::zeros(3);
let v7: Array1<i32> = Array1::zeros(3);
Zip::from(&v1)
	.and(&v2)
	.and(&v3)
	.and(&v4)
	.and(&v5)
	.and(&v6)
	.and(&v7)
	.for_each(|v1, v2, v3, v4, v5, v6, v7| {
		println!("{}, {}, {}, {}, {}, {}, {}", v1, v2, v3, v4, v5, v6, v7);
	});

Error:

error[E0599]: no method named and found for struct ndarray::Zip<(ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>), Dim<[usize; 1]>> in the current scope
--> src\main.rs:47:14
|
47 | .and(&v7)
| ^^^ method not found in ndarray::Zip<(ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>), Dim<[usize; 1]>>
|
= note: the method was found for
- ndarray::Zip<(P1,), D>
- ndarray::Zip<(P1, P2), D>
- ndarray::Zip<(P1, P2, P3), D>
- ndarray::Zip<(P1, P2, P3, P4), D>
- ndarray::Zip<(P1, P2, P3, P4, P5), D>

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.