# ISExpand
Computes the union of two index sets, by concatenating 2 lists and removing duplicates. 
## Synopsis
```
#include "petscis.h"  
PetscErrorCode ISExpand(IS is1, IS is2, IS *isout)
```
Collective on is1


## Input Parameters

- ***is1 -*** first index set
- ***is2 -*** index values to be added



## Output Parameters

- ***isout -*** is1 + is2 The index set is2 is appended to is1 removing duplicates





## Notes
Negative values are removed from the lists. This requires O(imax-imin)
memory and O(imax-imin) work, where imin and imax are the bounds on the
indices in is1 and is2.

The IS's do not need to be sorted.

The operations are performed separately on each MPI rank


## See Also
 [](sec_scatter), `IS`, `ISDestroy()`, `ISView()`, `ISDifference()`, `ISSum()`, `ISIntersect()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/is/utils/isdiff.c.html#ISExpand">src/vec/is/is/utils/isdiff.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex81.c.html">src/ksp/ksp/tutorials/ex81.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/is/is/utils/isdiff.c)


[Index of all IS routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
