# PetscMergeIntArrayPair
Merges two SORTED `PetscInt` arrays that share NO common values along with an additional array of `PetscInt`. The additional arrays are the same length as sorted arrays and are merged in the order determined by the merging of the sorted pair. 
## Synopsis
```
#include "petscsys.h"  
PetscErrorCode PetscMergeIntArrayPair(PetscInt an, const PetscInt aI[], const PetscInt aJ[], PetscInt bn, const PetscInt bI[], const PetscInt bJ[], PetscInt *n, PetscInt **L, PetscInt **J)
```
Not Collective


## Input Parameters

- ***an  -*** number of values in the first array
- ***aI  -*** first sorted array of integers
- ***aJ  -*** first additional array of integers
- ***bn  -*** number of values in the second array
- ***bI  -*** second array of integers
- ***bJ  -*** second additional of integers



## Output Parameters

- ***n   -*** number of values in the merged array (== an + bn)
- ***L   -*** merged sorted array
- ***J   -*** merged additional array



## Note
if L or J point to non-null arrays then this routine will assume they are of the approproate size and use them, otherwise this routine will allocate space for them




## See Also
 `PetscIntSortSemiOrdered()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()`

## Level
intermediate

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


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