petsc-3.6.2 2015-10-02
Report Typos and Errors

# KSPCG

The preconditioned conjugate gradient (PCG) iterative method

### Options Database Keys

| -ksp_cg_type Hermitian | - (for complex matrices only) indicates the matrix is Hermitian, see KSPCGSetType()
| -ksp_cg_type symmetric | - (for complex matrices only) indicates the matrix is symmetric
| -ksp_cg_single_reduction | - performs both inner products needed in the algorithm with a single MPI_Allreduce() call, see KSPCGUseSingleReduction()

Notes: The PCG method requires both the matrix and preconditioner to be symmetric positive (or negative) (semi) definite Only left preconditioning is supported.

For complex numbers there are two different CG methods. One for Hermitian symmetric matrices and one for non-Hermitian symmetric matrices. Use KSPCGSetType() to indicate which type you are using.

Developer Notes: KSPSolve_CG() should actually query the matrix to determine if it is Hermitian symmetric or not and NOT require the user to indicate it to the KSP object.

### References

Methods of Conjugate Gradients for Solving Linear Systems, Magnus R. Hestenes and Eduard Stiefel, Journal of Research of the National Bureau of Standards Vol. 49, No. 6, December 1952 Research Paper 2379 pp. 409--436.

### See Also

KSPCreate(), KSPSetType(), KSPType (for list of available types), KSP,
KSPCGSetType(), KSPCGUseSingleReduction(), KSPPIPECG, KSPGROPPCG

Level:beginner
Location: src/ksp/ksp/impls/cg/cg.c
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/ksp/pc/examples/tutorials/ex1.c.html
src/ksp/pc/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex54.c.html
src/ksp/ksp/examples/tutorials/ex55.c.html
src/ksp/ksp/examples/tutorials/ex56.c.html
src/tao/bound/examples/tutorials/jbearing2.c.html
src/tao/pde_constrained/examples/tutorials/parabolic.c.html