# PetscSortRealWithPermutation
Computes the permutation of `PetscReal` that gives a sorted sequence. 
## Synopsis
```
#include "petscsys.h"  
PetscErrorCode PetscSortRealWithPermutation(PetscInt n, const PetscReal 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
i is unchanged on output.


## See Also
 `PetscSortReal()`, `PetscSortIntWithPermutation()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/utils/sortip.c.html#PetscSortRealWithPermutation">src/sys/utils/sortip.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex13.c.html">src/snes/tutorials/ex13.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/extchem.c.html">src/ts/tutorials/extchem.c.html</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
