:orphan:
# ISIntersect
Computes the intersection of two index sets, by sorting and comparing. 
## Synopsis
```
#include "petscis.h"  
PetscErrorCode ISIntersect(IS is1, IS is2, IS *isout)
```
Collective


## Input Parameters

- ***is1 -*** first index set
- ***is2 -*** second index set



## Output Parameter

- ***isout -*** the sorted intersection of `is1` and `is2`





## Notes
Negative values are removed from the lists. This requires O(min(is1,is2))
memory and O(max(is1,is2)log(max(is1,is2))) work

`is1` and `is2` do not need to be sorted.

The operations are performed separately on each MPI rank


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

## Level
intermediate

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


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