Actual source code: cgimpl.h

  1: /*
  2:     Private Krylov Context Structure (KSP) for Conjugate Gradient

  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: */

  9: #pragma once

 11: /*
 12:         Defines the basic KSP object
 13: */
 14: #include <petsc/private/kspimpl.h>

 16: PETSC_INTERN PetscErrorCode KSPDestroy_CG(KSP);
 17: PETSC_INTERN PetscErrorCode KSPView_CG(KSP, PetscViewer);
 18: PETSC_INTERN PetscErrorCode KSPSetFromOptions_CG(KSP, PetscOptionItems);
 19: PETSC_INTERN PetscErrorCode KSPCGSetType_CG(KSP, KSPCGType);

 21: /*
 22:     This struct is shared by several KSP implementations
 23: */

 25: typedef struct {
 26:   KSPCGType type; /* type of system (symmetric or Hermitian) */

 28:   // The following arrays are of size ksp->maxit
 29:   PetscScalar *e, *d;
 30:   PetscReal   *ee, *dd; /* work space for Lanczos algorithm */

 32:   /* Trust region support */
 33:   PetscReal radius;
 34:   PetscReal obj;
 35:   PetscReal obj_min;

 37:   PetscBool singlereduction; /* use variant of CG that combines both inner products */
 38: } KSP_CG;