# ISEqual
Compares if two index sets have the same set of indices. 
## Synopsis
```
#include "petscis.h"  
PetscErrorCode ISEqual(IS is1, IS is2, PetscBool *flg)
```
Collective on is1


## Input Parameters

- ***is1, is2 -*** The index sets being compared



## Output Parameters

- ***flg -*** output flag, either `PETSC_TRUE` (if both index sets have the
same indices), or `PETSC_FALSE` if the index sets differ by size
or by the set of indices)





## Note
Unlike `ISEqualUnsorted()`, this routine sorts the contents of the index sets (only within each MPI rank) before
the comparison is made, so the order of the indices on a processor is immaterial.

Each processor has to have the same indices in the two sets, for example,
```none
Processor
```
```none
0      1
```
```none
is1 = {0, 1} {2, 3}
```
```none
is2 = {2, 3} {0, 1}
```
will return false.


## See Also
 [](sec_scatter), `IS`, `ISEqualUnsorted()`

## Level
intermediate

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


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