multi_permutation_iterator (sorry for the dupe) #247

wants to merge 8 commits into


None yet

1 participant


multi_permutation_iterator resolves issue 70 [1], which was opened based on a request [2] I made over two years ago.

This iterator is general purpose, but is of particular significance due to its application in efficiently implementing stencil operations and multi-dimensional arrays, both of which are areas in which Thrust is currently lacking.

If a proliferation of new iterators is to be avoided then perhaps the functionality provided by multi_permutation_iterator could be integrated into permutation_iterator, to directly generalize permutation_iterators present capabilities? As it stands they have analogous functionality, both index into another iterator. Their difference only lies in the types of indexes allowed: in the case of permutation iterator only types such as int can be used as indexes and therefore permutation_iterator dereferences to produces a single value, whereas multi_permutation_iterator allows for tuples to be used as input and therefore dereferences to produce multiple values.

[1] thrust/thrust#70

PS: My apologies for the duplicate pull request. I accidentally closed the previous one, and couldn't figure out how to re-open it.


I just wanted to mention that I've made multi_permutation_iterator compatible with the latest improvements to iterator_facade and iterator_adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment