Applies perm to values IN PLACE: afterwards element k is what was at perm(k).
perm itself is not modified.
perm is validated as a true permutation of 1..n before anything is written, since an
invalid one would silently duplicate some elements and drop others. Pass
assume_valid=.true. to skip that check when the permutation came from pf_argsort
and is known good -- it means the same thing for all eleven types, the two column ones
included.
assume_valid skips the O(n) contents check only. perm's LENGTH is checked either
way, because a short permutation would make the gather read past the end of values and
no promise from the caller can make that defined.