[Enhancement] Implement ParallelIterator
trait for Windows
#1322
Answered
by
bluss
rkshthrmsh
asked this question in
Q&A
-
Implementing the Here is an example: let a = arr
.windows((3, 3))
.into_par_iter()
.map(|w| (&w * &kernel).sum())
.collect::<Array1<f32>>(); |
Beta Was this translation helpful? Give feedback.
Answered by
bluss
Aug 7, 2023
Replies: 1 comment 8 replies
-
Windows is a producer (NdProducer trait) so it can already be parallelized using Zip |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also possible I think:
But par_map_collect makes an array the same size as the producer coming in. Maybe not what you want, but interesting to know about..
I'm a bit concerned about the into par iter collect since it does not have any guarantee about what order the elements end up.
But yes, is Zip enough or should it be a parallel iterator by itself? Try and see