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: #undef __FUNCT__  
  6: /*M
  7:     KSPGMRESSetHapTol - Sets the tolerence for GMRES and FGMRES to declare happy breakdown.
  8:     for GMRES before restart.

 10:    Synopsis:
 11:      int KSPGMRESSetHapTol(KSP ksp,PetscReal tol)

 13:     Collective on KSP

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

 19:     Options Database Key:
 20: .   -ksp_gmres_haptol <tol>

 22:     Level: advanced

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

 26: .seealso: KSPGMRESSetOrthogonalization(), KSPGMRESSetPreallocateVectors()
 27: M*/

 29: #undef __FUNCT__  
 31: /*MC
 32:     KSPGMRESSetRestart - Sets the number of search directions 
 33:     for GMRES and FGMRES before restart.

 35:    Synopsis:
 36:      int KSPGMRESSetRestart(KSP ksp,int max_k)

 38:     Collective on KSP

 40:     Input Parameters:
 41: +   ksp - the iterative context
 42: -   max_k - the number of directions

 44:     Options Database Key:
 45: .   -ksp_gmres_restart <max_k> - Sets max_k

 47:     Level: intermediate

 49:     Note:
 50:     The default value of max_k = 30.

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

 54: .seealso: KSPGMRESSetOrthogonalization(), KSPGMRESSetPreallocateVectors()
 55: M*/

 57: #undef __FUNCT__  
 59: /*@C
 60:    KSPGMRESSetOrthogonalization - Sets the orthogonalization routine used by GMRES and FGMRES.

 62:    Collective on KSP

 64:    Input Parameters:
 65: +  ksp - iterative context obtained from KSPCreate
 66: -  fcn - orthogonalization function

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

 73:    Notes:
 74:    Several orthogonalization routines are predefined, including

 76:    KSPGMRESModifiedGramSchmidtOrthogonalization()

 78:    KSPGMRESUnmodifiedGramSchmidtOrthogonalization() - 
 79:        NOT recommended; however, for some problems, particularly
 80:        when using parallel distributed vectors, this may be
 81:        significantly faster. Default.

 83:    KSPGMRESIROrthogonalization() - iterative refinement
 84:        version of KSPGMRESUnmodifiedGramSchmidtOrthogonalization(),
 85:        which may be more numerically stable.

 87:    Options Database Keys:

 89: +  -ksp_gmres_unmodifiedgramschmidt - Activates KSPGMRESUnmodifiedGramSchmidtOrthogonalization() (default)
 90: .  -ksp_gmres_modifiedgramschmidt - Activates KSPGMRESModifiedGramSchmidtOrthogonalization()
 91: -  -ksp_gmres_irorthog - Activates KSPGMRESIROrthogonalization()

 93:    Level: intermediate

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

 97: .seealso: KSPGMRESSetRestart(), KSPGMRESSetPreallocateVectors()
 98: @*/
 99: int KSPGMRESSetOrthogonalization(KSP ksp,int (*fcn)(KSP,int))
100: {
101:   int ierr,(*f)(KSP,int (*)(KSP,int));

105:   PetscObjectQueryFunction((PetscObject)ksp,"KSPGMRESSetOrthogonalization_C",(void (**)(void))&f);
106:   if (f) {
107:     (*f)(ksp,fcn);
108:   }
109:   return(0);
110: }