petsc-3.12.1 2019-10-22
Report Typos and Errors

# KSPBuildResidual

Builds the residual in a vector provided.

### Synopsis

    #include "petscksp.h"
    PetscErrorCode  KSPBuildResidual(KSP ksp,Vec t,Vec v,Vec *V)

Collective on ksp

### Input Parameter

ksp -iterative context obtained from KSPCreate()

### Output Parameters

| v | - optional location to stash residual. If v is not provided, then a location is generated.
| t | - work vector. If not provided then one is generated.
| V | - the residual

### Notes

Regardless of whether or not v is provided, the residual is returned in V.

### See Also

KSPBuildSolution()

### Level

advanced

### Location

src/ksp/ksp/interface/itfunc.c

### Examples

src/ksp/ksp/examples/tutorials/ex42.c.html

### Implementations

KSPBuildResidual_GCR in src/ksp/ksp/impls/gcr/gcr.c
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages