1 /* 2 Private Krylov Context Structure (KSP) for Conjugate Gradient 3 4 This one is very simple. It contains a flag indicating the symmetry 5 structure of the matrix and work space for (optionally) computing 6 eigenvalues. 7 */ 8 9 #pragma once 10 11 /* 12 Defines the basic KSP object 13 */ 14 #include <petsc/private/kspimpl.h> 15 16 PETSC_INTERN PetscErrorCode KSPDestroy_CG(KSP); 17 PETSC_INTERN PetscErrorCode KSPReset_CG(KSP); 18 PETSC_INTERN PetscErrorCode KSPView_CG(KSP, PetscViewer); 19 PETSC_INTERN PetscErrorCode KSPSetFromOptions_CG(KSP, PetscOptionItems); 20 PETSC_INTERN PetscErrorCode KSPCGSetType_CG(KSP, KSPCGType); 21 22 /* 23 This struct is shared by several KSP implementations 24 */ 25 26 typedef struct { 27 KSPCGType type; /* type of system (symmetric or Hermitian) */ 28 29 // The following arrays are of size ksp->maxit 30 PetscScalar *e, *d; 31 PetscReal *ee, *dd; /* work space for Lanczos algorithm */ 32 33 /* Trust region support */ 34 PetscReal radius; 35 PetscReal obj; 36 PetscReal obj_min; 37 38 PetscBool singlereduction; /* use variant of CG that combines both inner products */ 39 } KSP_CG; 40