PetscSortStrWithPermutation — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# PetscSortStrWithPermutation

Computes the permutation of strings that gives a sorted sequence.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscSortStrWithPermutation(PetscInt n, const char *i[], PetscInt idx[])

Not Collective, No Fortran Support

## 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[j]` is the position of the `j`th smallest `char *` in `i`.

## See Also

`PetscSortInt()`, `PetscSortRealWithPermutation()`

## Level

intermediate

## Location

src/sys/utils/sortip.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages