-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Zipping multiple array #567
Comments
Combining rayon with generic iterators (including itertools) is a hard problem -- #46. But specifically for zipping, I suppose you mean something like itertools' |
yes, |
@cuviper Is anyone working on it? If not I could probably implement it, I don't think it would require much work. I'd probably change the signature from |
@MaikKlein I don't know of anyone working on it. I don't think we would want to make a breaking change to the existing |
I'm working on this now... |
Hello @cuviper, is there any chance of adding to rayon in future? |
Well, clearly I stopped working on it, sorry about that. I just found my WIP branch and pushed it to my fork though, if anyone would like to pick that up and finish it: branch: https://github.com/cuviper/rayon/tree/multizip |
It looks complete, and the documentation states all the use cases. I think I can use it in my code base. Can I know what else is there to add? |
I honestly don't know what I thought was remaining... 😕 |
Hi Josh, I am using it in my crate as in here https://github.com/multiphase-rs/mulltiphase_rs/blob/master/src/dem/mod.rs#L50 and many other places which is not yet open source, by creating another package https://github.com/multiphase-rs/rayon. Please try to add it to the upcoming release of rayon. Thank you. |
Now that I look again, I'm not really happy with that function signature: pub fn multizip<T, I>(tuple: T) -> MultiZip<I>
where
T: IntoParallelIterator<Iter = MultiZip<I>>,
MultiZip<I>: ParallelIterator<Item = T::Item>,
{
tuple.into_par_iter()
} Having In our case, we defined I'm going to remove that and clean up the examples to match, then I'll open a PR. We can always add such a function later if there's a compelling case. |
711: impl IntoParallelIterator for tuples => MultiZip r=nikomatsakis a=cuviper This is implemented for tuples up to arity 12, much like the standard library's trait implementations. - For `(a, b, ...)`, it calls `into_par_iter()` on each member. - For `&(a, b, ...)`, it calls `par_iter()` on each member. - For `&mut (a, b, ...)`, it calls `par_iter_mut()` on each member. The resulting `MultiZip` iterator returns a tuple of the zipped items from each input iterator. Internally, it is implemented with macros that forward to a series of regular `zip`s, mapping to a flattened tuple. Closes #567. Co-authored-by: Josh Stone <[email protected]>
Thanks |
I am currently using
rayon
iterator for zipping two arrays. I need to zip multiple arrays and a combination of rayon anditertools
will definitely help. for now, I had to switch toitertools
which is sequential.See the similar request on itertools
The text was updated successfully, but these errors were encountered: