thrust/thrust — pull request #245 by andrewcorrigan (2012-10-17 13:42:09+00:00)
Title: multi_permutation_iterator

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 is 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] https://github.com/thrust/thrust/issues/70
[2] https://groups.google.com/d/msg/thrust-users/125vfWIGeQ4/LnTFRUu4eTwJ