Skip to main content
`Ctrl`+`K`

# KSPGetErrorHistory

Gets the array used to hold the error history and the number of residuals it contains.

## Synopsis

    #include "petscksp.h"
    #include "petscmat.h"
    PetscErrorCode KSPGetErrorHistory(KSP ksp, const PetscReal *a[], PetscInt *na)

Not Collective

## Input Parameter

- ksp - iterative solver obtained from `KSPCreate()`

## Output Parameters

- a - pointer to array to hold history (or `NULL`)

- na - number of used entries in a (or `NULL`)

## Note

This array is borrowed and should not be freed by the caller. Can only be called after a `KSPSetErrorHistory()` otherwise `a` and `na` are set to `NULL` and zero

## Fortran Note

      PetscReal, pointer :: a(:)

## See Also

KSP: Linear System Solvers, `KSPSetErrorHistory()`, `KSPGetResidualHistory()`, `KSP`

## Level

advanced

## Location

src/ksp/ksp/interface/itfunc.c

Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages