Skip to content
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

merge_sort #11

Closed
ntrost57 opened this issue Jun 24, 2018 · 7 comments
Closed

merge_sort #11

ntrost57 opened this issue Jun 24, 2018 · 7 comments
Labels

Comments

@ntrost57
Copy link

Does device wide merge_sort support in-place sorting (keys_input == keys_output and values_input == values_output)?
What about radix sort? I guess it does not support in-place sorting, but I could not find anything in the docs about it.

@jszuppe
Copy link
Contributor

jszuppe commented Jun 25, 2018

Unless, it's explicitly stated otherwise, input and output iterators must point to separate memory (separate ranges).

@ntrost57
Copy link
Author

Thank you for your answer. Is radix_sort and/or merge_sort stable? I cannot find anything in the docs about it, however, in the tests, you are comparing to std::stable_sort.

@jszuppe
Copy link
Contributor

jszuppe commented Jun 26, 2018

Radix sort is stable. Merge sort is not.

@ntrost57
Copy link
Author

Thank you very much! I have one more question:
Using zip_iterator to sort multiple values with the same key is straight forward. What about using zip_iterator with double buffers?

@jszuppe
Copy link
Contributor

jszuppe commented Jun 26, 2018

What about using zip_iterator with double buffers?

I don't think that's possible. double_buffer class template takes value type (T) not iterator type. I guess you may try modifying it to operate on iterators instead. You can always try to specialize it for zip_iterator.

@ntrost57
Copy link
Author

I am not sure if that is possible, with integers zip_iterator has value_type tuple<int*,int*> but radix_sort_impl() requires value_type tuple<int, int>* for buffers. The integer arrays packed with zip_iterator are not necessarily continuous in memory.

@jszuppe
Copy link
Contributor

jszuppe commented Jun 27, 2018

Yes, right now it's not possible. It would require some changes to radix sort implementation (it's doable). Right now there are not plans to do them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants