petsc-3.10.5 2019-03-28
Report Typos and Errors

# KSPGetOperators

Gets the matrix associated with the linear system and a (possibly) different one associated with the preconditioner.

### Synopsis

    #include "petscksp.h"
    PetscErrorCode  KSPGetOperators(KSP ksp,Mat *Amat,Mat *Pmat)

Collective on KSP and Mat

### Input Parameter

ksp -the KSP context

### Output Parameters

| Amat | - the matrix that defines the linear system
| Pmat | - the matrix to be used in constructing the preconditioner, usually the same as Amat.

### Notes

DOES NOT increase the reference counts of the matrix, so you should NOT destroy them.

### Keywords

KSP, set, get, operators, matrix, preconditioner, linear system

### See Also

KSPSolve(), KSPGetPC(), PCGetOperators(), PCSetOperators(), KSPSetOperators(), KSPGetOperatorsSet()

### Level

intermediate

### Location

src/ksp/ksp/interface/itcreate.c

### Examples

src/ksp/ksp/examples/tutorials/ex25.c.html
src/ksp/ksp/examples/tutorials/ex34.c.html
src/ksp/ksp/examples/tutorials/ex42.c.html
src/ksp/ksp/examples/tutorials/ex45.c.html
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages