# KSPGetOperators

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

### Synopsis

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

Collective on KSP and Mat

### Input Parameter

ksp -the KSP context

### Output Parameters

| Amat | - the matrix associated with the linear system
| Pmat | - the matrix to be used in constructing the preconditioner, usually the same as Amat.
| flag | - flag indicating information about the preconditioner matrix structure during successive linear solves. This flag is ignored the first time a linear system is solved, and thus is irrelevant when solving just one linear system.

### 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
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages