# PetscMPIIntSortSemiOrderedWithArray
Sorts an array of `PetscMPIInt` in place in increasing order and reorders a second `PetscMPIInt` array to match the first. 
## Synopsis
```
#include "petscsys.h"  
PetscErrorCode PetscMPIIntSortSemiOrderedWithArray(PetscInt n, PetscMPIInt arr1[], PetscMPIInt arr2[])
```
Not Collective


## Input Parameter

- ***n   -*** number of values



## Input/Output Parameters

- ***arr1 -*** array of integers to be sorted, modified on output


- ***arr2 -*** array of integers to be reordered, modified on output



## Notes
The arrays CANNOT overlap.

This function serves as an alternative to `PetscSortMPIIntWithArray()`. While this function works for any array of integers it is
significantly faster if the array is not totally random. There are exceptions to this and so it is __highly__
recommended that the user benchmark their code to see which routine is fastest.




## See Also
 `PetscTimSortWithArray()`, `PetscSortMPIIntWithArray()`, `PetscSortMPIIntWithPermutation()`

## Level
intermediate

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/utils/sortso.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)  
