# KSPComputeOperator
Computes the explicit preconditioned operator, including diagonal scaling and null space removal if applicable. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode KSPComputeOperator(KSP ksp, MatType mattype, Mat *mat)
```
Collective on ksp


## Input Parameters

- ***ksp -*** the Krylov subspace context
- ***mattype -*** the matrix type to be used



## Output Parameter

- ***mat -*** the explicit preconditioned operator



## Notes
This computation is done by applying the operators to columns of the
identity matrix.

Currently, this routine uses a dense matrix format for the output operator if mattype == NULL.
This routine is costly in general, and is recommended for use only with relatively small systems.




## See Also
 [](chapter_ksp), `KSP`, `KSPSetOperators()`, `KSPComputeEigenvaluesExplicitly()`, `PCComputeOperator()`, `KSPSetDiagonalScale()`, `KSPSetNullSpace()`, `MatType`

## Level
advanced

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


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


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