pf_permute (apply a permutation in place) and pf_is_sorted (test an existing order).
pf_permute gathers into a fresh array and moves it back, rather than following cycles in
place. Cycle-following would save the temporary, but it needs a "visited" bit per element and
would have to be written once per type anyway; the gather is one obvious pass, and for the two
container types the work is delegated to their own %reindex regardless.
perm is validated before anything is written. An invalid permutation does not fail -- it
silently duplicates some elements and drops others, which is precisely the wrong-answer-with-no-
symptom class this project guards hardest against. The check is O(n) in front of an O(n)
operation, so it is a constant factor rather than a change of complexity, which is why it is on
by default; assume_valid=.true. skips it for a permutation that came straight from
pf_argsort. It skips the CONTENTS check only -- perm's length is checked either way, since a
short permutation makes the gather read past the end of values.