Template Function brille::apply_inverse_permutation¶
Defined in File permutation.hpp
Function Documentation¶
-
template<typename
ObjItr, typenamePermItr>
voidbrille::apply_inverse_permutation(ObjItr objects, ObjItr end, PermItr indices)¶ Apply an inverse permutation to a random access iterable object.
For an inverse 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 inverse permuted iterable such thatpermuted_object_iterable[index_iterable[i]] = object_iterable[i]
for all
iby swapping elements in place and using the inverse permutation iterable as a scratch workspace.- 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 inverse permutation iterable