Actual source code: petscksp.h

  1: /*
  2:    Defines the interface functions for the Krylov subspace accelerators.
  3: */
  4: #ifndef __PETSCKSP_H
 6:  #include petscpc.h

  9: EXTERN PetscErrorCode  KSPInitializePackage(const char[]);

 11: /*S
 12:      KSP - Abstract PETSc object that manages all Krylov methods

 14:    Level: beginner

 16:   Concepts: Krylov methods

 18: .seealso:  KSPCreate(), KSPSetType(), KSPType, SNES, TS, PC, KSP
 19: S*/
 20: typedef struct _p_KSP*     KSP;

 22: /*E
 23:     KSPType - String with the name of a PETSc Krylov method or the creation function
 24:        with an optional dynamic library name, for example
 25:        http://www.mcs.anl.gov/petsc/lib.a:mykspcreate()

 27:    Level: beginner

 29: .seealso: KSPSetType(), KSP
 30: E*/
 31: #define KSPRICHARDSON "richardson"
 32: #define KSPCHEBYCHEV  "chebychev"
 33: #define KSPCG         "cg"
 34: #define   KSPCGNE       "cgne"
 35: #define   KSPSTCG       "stcg"
 36: #define KSPGMRES      "gmres"
 37: #define   KSPFGMRES     "fgmres" 
 38: #define   KSPLGMRES     "lgmres"
 39: #define KSPTCQMR      "tcqmr"
 40: #define KSPBCGS       "bcgs"
 41: #define KSPBCGSL      "bcgsl"
 42: #define KSPCGS        "cgs"
 43: #define KSPTFQMR      "tfqmr"
 44: #define KSPCR         "cr"
 45: #define KSPLSQR       "lsqr"
 46: #define KSPPREONLY    "preonly"
 47: #define KSPQCG        "qcg"
 48: #define KSPBICG       "bicg"
 49: #define KSPMINRES     "minres"
 50: #define KSPSYMMLQ     "symmlq"
 51: #define KSPLCD        "lcd"
 52: #define KSPType const char*

 54: /* Logging support */

 57: EXTERN PetscErrorCode  KSPCreate(MPI_Comm,KSP *);
 58: EXTERN PetscErrorCode  KSPSetType(KSP,KSPType);
 59: EXTERN PetscErrorCode  KSPSetUp(KSP);
 60: EXTERN PetscErrorCode  KSPSetUpOnBlocks(KSP);
 61: EXTERN PetscErrorCode  KSPSolve(KSP,Vec,Vec);
 62: EXTERN PetscErrorCode  KSPSolveTranspose(KSP,Vec,Vec);
 63: EXTERN PetscErrorCode  KSPDestroy(KSP);

 66: EXTERN PetscErrorCode  KSPRegisterAll(const char[]);
 67: EXTERN PetscErrorCode  KSPRegisterDestroy(void);
 68: EXTERN PetscErrorCode  KSPRegister(const char[],const char[],const char[],PetscErrorCode (*)(KSP));

 70: /*MC
 71:    KSPRegisterDynamic - Adds a method to the Krylov subspace solver package.

 73:    Synopsis:
 74:    PetscErrorCode KSPRegisterDynamic(char *name_solver,char *path,char *name_create,PetscErrorCode (*routine_create)(KSP))

 76:    Not Collective

 78:    Input Parameters:
 79: +  name_solver - name of a new user-defined solver
 80: .  path - path (either absolute or relative) the library containing this solver
 81: .  name_create - name of routine to create method context
 82: -  routine_create - routine to create method context

 84:    Notes:
 85:    KSPRegisterDynamic() may be called multiple times to add several user-defined solvers.

 87:    If dynamic libraries are used, then the fourth input argument (routine_create)
 88:    is ignored.

 90:    Sample usage:
 91: .vb
 92:    KSPRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a,
 93:                "MySolverCreate",MySolverCreate);
 94: .ve

 96:    Then, your solver can be chosen with the procedural interface via
 97: $     KSPSetType(ksp,"my_solver")
 98:    or at runtime via the option
 99: $     -ksp_type my_solver

101:    Level: advanced

103:    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
104:           and others of the form ${any_environmental_variable} occuring in pathname will be 
105:           replaced with appropriate values.
106:          If your function is not being put into a shared library then use KSPRegister() instead

108: .keywords: KSP, register

110: .seealso: KSPRegisterAll(), KSPRegisterDestroy()

112: M*/
113: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
114: #define KSPRegisterDynamic(a,b,c,d) KSPRegister(a,b,c,0)
115: #else
116: #define KSPRegisterDynamic(a,b,c,d) KSPRegister(a,b,c,d)
117: #endif

119: EXTERN PetscErrorCode  KSPGetType(KSP,KSPType *);
120: EXTERN PetscErrorCode  KSPSetPreconditionerSide(KSP,PCSide);
121: EXTERN PetscErrorCode  KSPGetPreconditionerSide(KSP,PCSide*);
122: EXTERN PetscErrorCode  KSPGetTolerances(KSP,PetscReal*,PetscReal*,PetscReal*,PetscInt*);
123: EXTERN PetscErrorCode  KSPSetTolerances(KSP,PetscReal,PetscReal,PetscReal,PetscInt);
124: EXTERN PetscErrorCode  KSPSetInitialGuessNonzero(KSP,PetscTruth);
125: EXTERN PetscErrorCode  KSPGetInitialGuessNonzero(KSP,PetscTruth *);
126: EXTERN PetscErrorCode  KSPSetInitialGuessKnoll(KSP,PetscTruth);
127: EXTERN PetscErrorCode  KSPGetInitialGuessKnoll(KSP,PetscTruth*);
128: EXTERN PetscErrorCode  KSPGetComputeEigenvalues(KSP,PetscTruth*);
129: EXTERN PetscErrorCode  KSPSetComputeEigenvalues(KSP,PetscTruth);
130: EXTERN PetscErrorCode  KSPGetComputeSingularValues(KSP,PetscTruth*);
131: EXTERN PetscErrorCode  KSPSetComputeSingularValues(KSP,PetscTruth);
132: EXTERN PetscErrorCode  KSPGetRhs(KSP,Vec *);
133: EXTERN PetscErrorCode  KSPGetSolution(KSP,Vec *);
134: EXTERN PetscErrorCode  KSPGetResidualNorm(KSP,PetscReal*);
135: EXTERN PetscErrorCode  KSPGetIterationNumber(KSP,PetscInt*);
136: EXTERN PetscErrorCode  KSPSetNullSpace(KSP,MatNullSpace);
137: EXTERN PetscErrorCode  KSPGetNullSpace(KSP,MatNullSpace*);
138: EXTERN PetscErrorCode  KSPGetVecs(KSP,PetscInt,Vec**,PetscInt,Vec**);

140: EXTERN PetscErrorCode  KSPSetPC(KSP,PC);
141: EXTERN PetscErrorCode  KSPGetPC(KSP,PC*);

143: EXTERN PetscErrorCode  KSPMonitorSet(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*),void *,PetscErrorCode (*)(void*));
144: EXTERN PetscErrorCode  KSPMonitorCancel(KSP);
145: EXTERN PetscErrorCode  KSPGetMonitorContext(KSP,void **);
146: EXTERN PetscErrorCode  KSPGetResidualHistory(KSP,PetscReal*[],PetscInt *);
147: EXTERN PetscErrorCode  KSPSetResidualHistory(KSP,PetscReal[],PetscInt,PetscTruth);

149: /* not sure where to put this */
150: EXTERN PetscErrorCode  PCKSPGetKSP(PC,KSP*);
151: EXTERN PetscErrorCode  PCBJacobiGetSubKSP(PC,PetscInt*,PetscInt*,KSP*[]);
152: EXTERN PetscErrorCode  PCASMGetSubKSP(PC,PetscInt*,PetscInt*,KSP*[]);
153: EXTERN PetscErrorCode  PCFieldSplitGetSubKSP(PC,PetscInt*,KSP*[]);

155: EXTERN PetscErrorCode  PCGalerkinGetKSP(PC,KSP *);

157: EXTERN PetscErrorCode  KSPBuildSolution(KSP,Vec,Vec *);
158: EXTERN PetscErrorCode  KSPBuildResidual(KSP,Vec,Vec,Vec *);

160: EXTERN PetscErrorCode  KSPRichardsonSetScale(KSP,PetscReal);
161: EXTERN PetscErrorCode  KSPChebychevSetEigenvalues(KSP,PetscReal,PetscReal);
162: EXTERN PetscErrorCode  KSPComputeExtremeSingularValues(KSP,PetscReal*,PetscReal*);
163: EXTERN PetscErrorCode  KSPComputeEigenvalues(KSP,PetscInt,PetscReal*,PetscReal*,PetscInt *);
164: EXTERN PetscErrorCode  KSPComputeEigenvaluesExplicitly(KSP,PetscInt,PetscReal*,PetscReal*);

166: EXTERN PetscErrorCode  KSPGMRESSetRestart(KSP, PetscInt);
167: EXTERN PetscErrorCode  KSPGMRESSetHapTol(KSP,PetscReal);

169: EXTERN PetscErrorCode  KSPGMRESSetPreAllocateVectors(KSP);
170: EXTERN PetscErrorCode  KSPGMRESSetOrthogonalization(KSP,PetscErrorCode (*)(KSP,PetscInt));
171: EXTERN PetscErrorCode  KSPGMRESModifiedGramSchmidtOrthogonalization(KSP,PetscInt);
172: EXTERN PetscErrorCode  KSPGMRESClassicalGramSchmidtOrthogonalization(KSP,PetscInt);

174: EXTERN PetscErrorCode  KSPLGMRESSetAugDim(KSP,PetscInt);
175: EXTERN PetscErrorCode  KSPLGMRESSetConstant(KSP);

177: /*E
178:     KSPGMRESCGSRefinementType - How the classical (unmodified) Gram-Schmidt is performed.

180:    Level: advanced

182: .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(),
183:           KSPGMRESSetCGSRefinementType(), KSPGMRESModifiedGramSchmidtOrthogonalization()

185: E*/
186: typedef enum {KSP_GMRES_CGS_REFINE_NEVER, KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS} KSPGMRESCGSRefinementType;
188: /*MC
189:     KSP_GMRES_CGS_REFINE_NEVER - Just do the classical (unmodified) Gram-Schmidt process

191:    Level: advanced

193:    Note: Possible unstable, but the fastest to compute

195: .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(),
196:           KSPGMRESSetCGSRefinementType(), KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS,
197:           KSPGMRESModifiedGramSchmidtOrthogonalization()
198: M*/

200: /*MC
201:     KSP_GMRES_CGS_REFINE_IFNEEDED - Do the classical (unmodified) Gram-Schmidt process and one step of 
202:           iterative refinement if an estimate of the orthogonality of the resulting vectors indicates
203:           poor orthogonality.

205:    Level: advanced

207:    Note: This is slower than KSP_GMRES_CGS_REFINE_NEVER because it requires an extra norm computation to 
208:      estimate the orthogonality but is more stable.

210: .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(),
211:           KSPGMRESSetCGSRefinementType(), KSP_GMRES_CGS_REFINE_NEVER, KSP_GMRES_CGS_REFINE_ALWAYS,
212:           KSPGMRESModifiedGramSchmidtOrthogonalization()
213: M*/

215: /*MC
216:     KSP_GMRES_CGS_REFINE_NEVER - Do two steps of the classical (unmodified) Gram-Schmidt process.

218:    Level: advanced

220:    Note: This is roughly twice the cost of KSP_GMRES_CGS_REFINE_NEVER because it performs the process twice
221:      but it saves the extra norm calculation needed by KSP_GMRES_CGS_REFINE_IFNEEDED.

223:         You should only use this if you absolutely know that the iterative refinement is needed.

225: .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(),
226:           KSPGMRESSetCGSRefinementType(), KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS,
227:           KSPGMRESModifiedGramSchmidtOrthogonalization()
228: M*/

230: EXTERN PetscErrorCode  KSPGMRESSetCGSRefinementType(KSP,KSPGMRESCGSRefinementType);

232: EXTERN PetscErrorCode  KSPFGMRESModifyPCNoChange(KSP,PetscInt,PetscInt,PetscReal,void*);
233: EXTERN PetscErrorCode  KSPFGMRESModifyPCKSP(KSP,PetscInt,PetscInt,PetscReal,void*);
234: EXTERN PetscErrorCode  KSPFGMRESSetModifyPC(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscInt,PetscReal,void*),void*,PetscErrorCode(*)(void*));

236: EXTERN PetscErrorCode  KSPQCGSetTrustRegionRadius(KSP,PetscReal);
237: EXTERN PetscErrorCode  KSPQCGGetQuadratic(KSP,PetscReal*);
238: EXTERN PetscErrorCode  KSPQCGGetTrialStepNorm(KSP,PetscReal*);

240: EXTERN PetscErrorCode  KSPBCGSLSetXRes(KSP,PetscReal);
241: EXTERN PetscErrorCode  KSPBCGSLSetPol(KSP,PetscTruth);
242: EXTERN PetscErrorCode  KSPBCGSLSetEll(KSP,int);

244: EXTERN PetscErrorCode  KSPSetFromOptions(KSP);
245: EXTERN PetscErrorCode  KSPAddOptionsChecker(PetscErrorCode (*)(KSP));

247: EXTERN PetscErrorCode  KSPMonitorSingularValue(KSP,PetscInt,PetscReal,void *);
248: EXTERN PetscErrorCode  KSPMonitorDefault(KSP,PetscInt,PetscReal,void *);
249: EXTERN PetscErrorCode  KSPMonitorTrueResidualNorm(KSP,PetscInt,PetscReal,void *);
250: EXTERN PetscErrorCode  KSPMonitorDefaultShort(KSP,PetscInt,PetscReal,void *);
251: EXTERN PetscErrorCode  KSPMonitorSolution(KSP,PetscInt,PetscReal,void *);
252: EXTERN PetscErrorCode  KSPGMRESMonitorKrylov(KSP,PetscInt,PetscReal,void *);

254: EXTERN PetscErrorCode  KSPUnwindPreconditioner(KSP,Vec,Vec);
255: EXTERN PetscErrorCode  KSPDefaultBuildSolution(KSP,Vec,Vec*);
256: EXTERN PetscErrorCode  KSPDefaultBuildResidual(KSP,Vec,Vec,Vec *);
257: EXTERN PetscErrorCode  KSPInitialResidual(KSP,Vec,Vec,Vec,Vec,Vec);

259: EXTERN PetscErrorCode  KSPSetOperators(KSP,Mat,Mat,MatStructure);
260: EXTERN PetscErrorCode  KSPGetOperators(KSP,Mat*,Mat*,MatStructure*);
261: EXTERN PetscErrorCode  KSPGetOperatorsSet(KSP,PetscTruth*,PetscTruth*);
262: EXTERN PetscErrorCode  KSPSetOptionsPrefix(KSP,const char[]);
263: EXTERN PetscErrorCode  KSPAppendOptionsPrefix(KSP,const char[]);
264: EXTERN PetscErrorCode  KSPGetOptionsPrefix(KSP,const char*[]);

266: EXTERN PetscErrorCode  KSPSetDiagonalScale(KSP,PetscTruth);
267: EXTERN PetscErrorCode  KSPGetDiagonalScale(KSP,PetscTruth*);
268: EXTERN PetscErrorCode  KSPSetDiagonalScaleFix(KSP,PetscTruth);
269: EXTERN PetscErrorCode  KSPGetDiagonalScaleFix(KSP,PetscTruth*);

271: EXTERN PetscErrorCode  KSPView(KSP,PetscViewer);

273: EXTERN PetscErrorCode  KSPLSQRSetStandardErrorVec(KSP,Vec);
274: EXTERN PetscErrorCode  KSPLSQRGetStandardErrorVec(KSP,Vec*);

276: /*E
277:     KSPNormType - Norm that is passed in the Krylov convergence
278:        test routines.

280:    Level: advanced

282:    Notes: this must match finclude/petscksp.h 

284: .seealso: KSPSolve(), KSPGetConvergedReason(), KSPSetNormType(),
285:           KSPSetConvergenceTest()
286: E*/
287: typedef enum {KSP_NO_NORM = 0,KSP_PRECONDITIONED_NORM = 1,KSP_UNPRECONDITIONED_NORM = 2,KSP_NATURAL_NORM = 3} KSPNormType;
289: /*MC
290:     KSP_NO_NORM - Do not compute a norm during the Krylov process. This will 
291:           possibly save some computation but means the convergence test cannot
292:           be based on a norm of a residual etc.

294:    Level: advanced

296:     Note: Some Krylov methods need to compute a residual norm and then this option is ignored

298: .seealso: KSPNormType, KSPSetNormType(), KSP_PRECONDITIONED_NORM, KSP_UNPRECONDITIONED_NORM, KSP_NATURAL_NORM
299: M*/

301: /*MC
302:     KSP_PRECONDITIONED_NORM - Compute the norm of the preconditioned residual and pass that to the 
303:        convergence test routine.

305:    Level: advanced

307: .seealso: KSPNormType, KSPSetNormType(), KSP_NO_NORM, KSP_UNPRECONDITIONED_NORM, KSP_NATURAL_NORM, KSPSetConvergenceTest()
308: M*/

310: /*MC
311:     KSP_UNPRECONDITIONED_NORM - Compute the norm of the true residual (b - A*x) and pass that to the 
312:        convergence test routine.

314:    Level: advanced

316: .seealso: KSPNormType, KSPSetNormType(), KSP_NO_NORM, KSP_PRECONDITIONED_NORM, KSP_NATURAL_NORM, KSPSetConvergenceTest()
317: M*/

319: /*MC
320:     KSP_NATURAL_NORM - Compute the 'natural norm' of residual sqrt((b - A*x)*B*(b - A*x)) and pass that to the 
321:        convergence test routine.

323:    Level: advanced

325: .seealso: KSPNormType, KSPSetNormType(), KSP_NO_NORM, KSP_PRECONDITIONED_NORM, KSP_UNPRECONDITIONED_NORM, KSPSetConvergenceTest()
326: M*/

328: EXTERN PetscErrorCode  KSPSetNormType(KSP,KSPNormType);

330: /*E
331:     KSPConvergedReason - reason a Krylov method was said to 
332:          have converged or diverged

334:    Level: beginner

336:    Notes: this must match finclude/petscksp.h 

338:    Developer note: The string versions of these are in 
339:      src/ksp/ksp/interface/itfunc.c called convergedreasons.
340:      If these enums are changed you must change those.

342: .seealso: KSPSolve(), KSPGetConvergedReason(), KSPSetTolerances()
343: E*/
344: typedef enum {/* converged */
345:               KSP_CONVERGED_RTOL               =  2,
346:               KSP_CONVERGED_ATOL               =  3,
347:               KSP_CONVERGED_ITS                =  4,
348:               KSP_CONVERGED_STCG_NEG_CURVE     =  5,
349:               KSP_CONVERGED_STCG_CONSTRAINED   =  6,
350:               KSP_CONVERGED_STEP_LENGTH        =  7,
351:               KSP_CONVERGED_HAPPY_BREAKDOWN    =  8,
352:               /* diverged */
353:               KSP_DIVERGED_NULL                = -2,
354:               KSP_DIVERGED_ITS                 = -3,
355:               KSP_DIVERGED_DTOL                = -4,
356:               KSP_DIVERGED_BREAKDOWN           = -5,
357:               KSP_DIVERGED_BREAKDOWN_BICG      = -6,
358:               KSP_DIVERGED_NONSYMMETRIC        = -7,
359:               KSP_DIVERGED_INDEFINITE_PC       = -8,
360:               KSP_DIVERGED_NAN                 = -9,
361:               KSP_DIVERGED_INDEFINITE_MAT      = -10,
362: 
363:               KSP_CONVERGED_ITERATING          =  0} KSPConvergedReason;

366: /*MC
367:      KSP_CONVERGED_RTOL - norm(r) <= rtol*norm(b)

369:    Level: beginner

371:    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
372:        for left preconditioning it is the 2-norm of the preconditioned residual, and the
373:        2-norm of the residual for right preconditioning

375: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

377: M*/

379: /*MC
380:      KSP_CONVERGED_ATOL - norm(r) <= atol

382:    Level: beginner

384:    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
385:        for left preconditioning it is the 2-norm of the preconditioned residual, and the
386:        2-norm of the residual for right preconditioning

388:    Level: beginner

390: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

392: M*/

394: /*MC
395:      KSP_DIVERGED_DTOL - norm(r) >= dtol*norm(b)

397:    Level: beginner

399:    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
400:        for left preconditioning it is the 2-norm of the preconditioned residual, and the
401:        2-norm of the residual for right preconditioning

403:    Level: beginner

405: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

407: M*/

409: /*MC
410:      KSP_DIVERGED_ITS - Ran out of iterations before any convergence criteria was 
411:       reached

413:    Level: beginner

415: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

417: M*/

419: /*MC
420:      KSP_CONVERGED_ITS - Used by the KSPPREONLY solver after the single iteration of the
421:            preconditioner is applied.


424:    Level: beginner


427: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

429: M*/

431: /*MC
432:      KSP_DIVERGED_BREAKDOWN - A breakdown in the Krylov method was detected so the
433:           method could not continue to enlarge the Krylov space.

435:    Level: beginner

437: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

439: M*/

441: /*MC
442:      KSP_DIVERGED_BREAKDOWN_BICG - A breakdown in the KSPBICG method was detected so the
443:           method could not continue to enlarge the Krylov space.


446:    Level: beginner


449: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

451: M*/

453: /*MC
454:      KSP_DIVERGED_NONSYMMETRIC - It appears the operator or preconditioner is not
455:         symmetric and this Krylov method (KSPCG, KSPMINRES, KSPCR) requires symmetry

457:    Level: beginner

459: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

461: M*/

463: /*MC
464:      KSP_DIVERGED_INDEFINITE_PC - It appears the preconditioner is indefinite (has both
465:         positive and negative eigenvalues) and this Krylov method (KSPCG) requires it to
466:         be positive definite

468:    Level: beginner

470:      Notes: This can happen with the PCICC preconditioner, use -pc_factor_shift_positive_definite to force 
471:   the PCICC preconditioner to generate a positive definite preconditioner

473: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

475: M*/

477: /*MC
478:      KSP_CONVERGED_ITERATING - This flag is returned if you call KSPGetConvergedReason()
479:         while the KSPSolve() is still running.

481:    Level: beginner

483: .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()

485: M*/

487: EXTERN PetscErrorCode  KSPSetConvergenceTest(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscReal,KSPConvergedReason*,void*),void *);
488: EXTERN PetscErrorCode  KSPGetConvergenceContext(KSP,void **);
489: EXTERN PetscErrorCode  KSPDefaultConverged(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
490: EXTERN PetscErrorCode  KSPDefaultConvergedSetUIRNorm(KSP);
491: EXTERN PetscErrorCode  KSPDefaultConvergedSetUMIRNorm(KSP);
492: EXTERN PetscErrorCode  KSPSkipConverged(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
493: EXTERN PetscErrorCode  KSPGetConvergedReason(KSP,KSPConvergedReason *);

495: EXTERN PetscErrorCode  KSPComputeExplicitOperator(KSP,Mat *);

497: /*E
498:     KSPCGType - Determines what type of CG to use

500:    Level: beginner

502: .seealso: KSPCGSetType()
503: E*/
504: typedef enum {KSP_CG_SYMMETRIC=0,KSP_CG_HERMITIAN=1} KSPCGType;

507: EXTERN PetscErrorCode  KSPCGSetType(KSP,KSPCGType);
508: EXTERN PetscErrorCode  KSPSTCGSetRadius(KSP,PetscReal);
509: EXTERN PetscErrorCode  KSPSTCGGetNormD(KSP,PetscReal *);

511: EXTERN PetscErrorCode  PCPreSolve(PC,KSP);
512: EXTERN PetscErrorCode  PCPostSolve(PC,KSP);

514: EXTERN PetscErrorCode  KSPMonitorLGCreate(const char[],const char[],int,int,int,int,PetscDrawLG*);
515: EXTERN PetscErrorCode  KSPMonitorLG(KSP,PetscInt,PetscReal,void*);
516: EXTERN PetscErrorCode  KSPMonitorLGDestroy(PetscDrawLG);
517: EXTERN PetscErrorCode  KSPMonitorLGTrueResidualNormCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscDrawLG*);
518: EXTERN PetscErrorCode  KSPMonitorLGTrueResidualNorm(KSP,PetscInt,PetscReal,void*);
519: EXTERN PetscErrorCode  KSPMonitorLGTrueResidualNormDestroy(PetscDrawLG);

521: EXTERN PetscErrorCode  PCShellSetPreSolve(PC,PetscErrorCode (*)(void*,KSP,Vec,Vec));
522: EXTERN PetscErrorCode  PCShellSetPostSolve(PC,PetscErrorCode (*)(void*,KSP,Vec,Vec));

525: #endif