Template Function sequant::sort_then_replace_by_ordinals¶
Defined in File utils.hpp
Function Documentation¶
-
template<typename IntegerSequence>
int sequant::sort_then_replace_by_ordinals(IntegerSequence &iseq)¶ sorts a sequence of integers in the lexicographic order (w.r.t. operator<) and overwrites them with their input ordinals e.g.
{23,7,14}is overwritten with{1,2,0}. Effectively, this inverts the permutation (input is a to-permutation, the results is a from-permutation, just reindexed)- Parameters:
iseq – [inout] on input: a sequence of integers, on output: sequence of input ordinals of the elements of sorted
seq- Returns:
-1 if permutation is off parity, else