:orphan: # PetscSortIntWithPermutation Computes the permutation of `PetscInt` that gives a sorted sequence. ## Synopsis ``` #include "petscsys.h" PetscErrorCode PetscSortIntWithPermutation(PetscInt n, const PetscInt i[], PetscInt idx[]) ``` Not Collective ## Input Parameters - ***n -*** number of values to sort - ***i -*** values to sort - ***idx -*** permutation array. Must be initialized to 0:n-1 on input. ## Note On output i is unchanged and idx[i] is the position of the i-th smallest index in i. ## See Also `PetscSortInt()`, `PetscSortRealWithPermutation()`, `PetscSortIntWithArray()` ## Level intermediate ## Location src/sys/utils/sortip.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/utils/sortip.c) [Index of all Sys routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)