:orphan:
# KSPGetOperatorsSet
Determines if the matrix associated with the linear system and possibly a different one associated with the preconditioner have been set in the `KSP`. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode KSPGetOperatorsSet(KSP ksp, PetscBool *mat, PetscBool *pmat)
```
Not Collective, though the results on all processes should be the same


## Input Parameter

- ***pc -*** the `KSP` context



## Output Parameters

- ***mat -*** the matrix associated with the linear system was set
- ***pmat -*** matrix associated with the preconditioner was set, usually the same as `mat`





## Note
This routine exists because if you call `KSPGetOperators()` on a `KSP` that does not yet have operators they are
automatically created in the call.


## See Also
 `KSP`, `PCSetOperators()`, `KSPGetOperators()`, `KSPSetOperators()`, `PCGetOperators()`, `PCGetOperatorsSet()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/interface/itcreate.c.html#KSPGetOperatorsSet">src/ksp/ksp/interface/itcreate.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/interface/itcreate.c)


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