thrust/thrust — pull request #247 by andrewcorrigan (2012-10-23 00:58:53+00:00)
Title: multi_permutation_iterator (sorry for the dupe)

First of all, my apologies for the duplicate pull request. I accidentally closed the previous one, and couldn't figure out how to re-open it.

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