# KSPCGSetType

Sets the variant of the conjugate gradient method to use for solving a linear system with a complex coefficient matrix. This option is irrelevant when solving a real system.

### Synopsis

    #include "petscksp.h"
    PetscErrorCode PETSCKSP_DLLEXPORT KSPCGSetType(KSP ksp,KSPCGType type)

Collective on KSP

### Input Parameters

| ksp | - the iterative context
| type | - the variant of CG to use, one of

          KSP_CG_HERMITIAN - complex, Hermitian matrix (default)
          KSP_CG_SYMMETRIC - complex, symmetric matrix

### Options Database Keys

| -ksp_cg_Hermitian | - Indicates Hermitian matrix
| -ksp_cg_symmetric | - Indicates symmetric matrix

### Note

By default, the matrix is assumed to be complex, Hermitian.

### Keywords

CG, conjugate gradient, Hermitian, symmetric, set, type

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