# ISDifference
Computes the difference between two index sets. 
## Synopsis
```
#include "petscis.h"  
PetscErrorCode ISDifference(IS is1, IS is2, IS *isout)
```
Collective on is1


## Input Parameters

- ***is1 -*** first index, to have items removed from it
- ***is2 -*** index values to be removed



## Output Parameters

- ***isout -*** is1 - is2





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

If is2 is NULL, the result is the same as for an empty IS, i.e., a duplicate of is1.

The difference is computed separately on each MPI rank


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

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/is/utils/isdiff.c.html#ISDifference">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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
