Actual source code: gmres2.c

  1: /*$Id: gmres2.c,v 1.35 2001/08/06 21:16:44 bsmith Exp $*/
 2:  #include src/sles/ksp/impls/gmres/gmresp.h

  4: /*M
  5:     KSPGMRESSetHapTol - Sets the tolerence for GMRES to declare happy breakdown.
  6:     for GMRES before restart.

  8:    Synopsis:
  9:      int KSPGMRESSetHapTol(KSP ksp,PetscReal tol)

 11:     Collective on KSP

 13:     Input Parameters:
 14: +   ksp - the iterative context
 15: -   tol - the tolerance (1.e-10 is the default)

 17:     Options Database Key:
 18: .   -ksp_gmres_haptol <tol>

 20:     Level: advanced

 22: .keywords: KSP, GMRES, set, happy breakdown

 24: .seealso: KSPGMRESSetOrthogonalization(), KSPGMRESSetPreallocateVectors()
 25: M*/

 27: /*MC
 28:     KSPGMRESSetRestart - Sets the number of search directions 
 29:     for GMRES before restart.

 31:    Synopsis:
 32:      int KSPGMRESSetRestart(KSP ksp,int max_k)

 34:     Collective on KSP

 36:     Input Parameters:
 37: +   ksp - the iterative context
 38: -   max_k - the number of directions

 40:     Options Database Key:
 41: .   -ksp_gmres_restart <max_k> - Sets max_k

 43:     Level: intermediate

 45:     Note:
 46:     The default value of max_k = 30.

 48: .keywords: KSP, GMRES, set, restart

 50: .seealso: KSPGMRESSetOrthogonalization(), KSPGMRESSetPreallocateVectors()
 51: M*/

 53: /*@C
 54:    KSPGMRESSetOrthogonalization - Sets the orthogonalization routine used by GMRES.

 56:    Collective on KSP

 58:    Input Parameters:
 59: +  ksp - iterative context obtained from KSPCreate
 60: -  fcn - orthogonalization function

 62:    Calling Sequence of function:
 63: $   errorcode = int fcn(KSP ksp,int it);
 64: $   it is one minus the number of GMRES iterations since last restart;
 65: $    i.e. the size of Krylov space minus one

 67:    Notes:
 68:    Several orthogonalization routines are predefined, including

 70:    KSPGMRESModifiedGramSchmidtOrthogonalization()

 72:    KSPGMRESUnmodifiedGramSchmidtOrthogonalization() - 
 73:        NOT recommended; however, for some problems, particularly
 74:        when using parallel distributed vectors, this may be
 75:        significantly faster. Default.

 77:    KSPGMRESIROrthogonalization() - iterative refinement
 78:        version of KSPGMRESUnmodifiedGramSchmidtOrthogonalization(),
 79:        which may be more numerically stable.

 81:    Options Database Keys:

 83: +  -ksp_gmres_unmodifiedgramschmidt - Activates KSPGMRESUnmodifiedGramSchmidtOrthogonalization() (default)
 84: .  -ksp_gmres_modifiedgramschmidt - Activates KSPGMRESModifiedGramSchmidtOrthogonalization()
 85: -  -ksp_gmres_irorthog - Activates KSPGMRESIROrthogonalization()

 87:    Level: intermediate

 89: .keywords: KSP, GMRES, set, orthogonalization, Gram-Schmidt, iterative refinement

 91: .seealso: KSPGMRESSetRestart(), KSPGMRESSetPreallocateVectors()
 92: @*/
 93: int KSPGMRESSetOrthogonalization(KSP ksp,int (*fcn)(KSP,int))
 94: {
 95:   int ierr,(*f)(KSP,int (*)(KSP,int));

 99:   PetscObjectQueryFunction((PetscObject)ksp,"KSPGMRESSetOrthogonalization_C",(void (**)(void))&f);
100:   if (f) {
101:     (*f)(ksp,fcn);
102:   }
103:   return(0);
104: }