Template Function brille::apply_permutation¶
Defined in File permutation.hpp
Function Documentation¶
-
template<typename
ObjItr, typenamePermItr>
voidbrille::apply_permutation(ObjItr objects, ObjItr end, PermItr indices)¶ Apply a permutation to a random access iterable object.
For a permutation held in one random access iterable object of length
Ncomprised of the integers(0,N]in some order, and a second iterable containingNobjects, find the permuted iterable such thatpermuted_object_iterable[i] = object_iterable[index_iterable[i]]
for all
iby swapping elements in place and using the permutation iterable as a scratch workspace.Upon completion the permutation iterable will be ordered 0:N-1.
- Parameters
objects: An iterator pointing to the first element of the object iterableend: An iterator pointing to the end of the object iterableindices: An iterator pointing to the first element of the permutation iterable