xref: /petsc/include/petscksp.h (revision 4f8e6cd90279fff794c0eade12278f451a8ca5e7)
1f26ada1bSBarry Smith /*
2f26ada1bSBarry Smith    Defines the interface functions for the Krylov subspace accelerators.
3f26ada1bSBarry Smith */
40a835dfdSSatish Balay #ifndef __PETSCKSP_H
50a835dfdSSatish Balay #define __PETSCKSP_H
60a835dfdSSatish Balay #include "petscpc.h"
7e9fa29b7SSatish Balay PETSC_EXTERN_CXX_BEGIN
82eac72dbSBarry Smith 
97087cfbeSBarry Smith extern PetscErrorCode  KSPInitializePackage(const char[]);
101dbb0a54SBarry Smith 
1128ce4d24SBarry Smith /*S
1228ce4d24SBarry Smith      KSP - Abstract PETSc object that manages all Krylov methods
1328ce4d24SBarry Smith 
1428ce4d24SBarry Smith    Level: beginner
1528ce4d24SBarry Smith 
1628ce4d24SBarry Smith   Concepts: Krylov methods
1728ce4d24SBarry Smith 
1894b7f48cSBarry Smith .seealso:  KSPCreate(), KSPSetType(), KSPType, SNES, TS, PC, KSP
1928ce4d24SBarry Smith S*/
20e2a1c21fSSatish Balay typedef struct _p_KSP*     KSP;
212eac72dbSBarry Smith 
2228ce4d24SBarry Smith /*E
2328ce4d24SBarry Smith     KSPType - String with the name of a PETSc Krylov method or the creation function
2428ce4d24SBarry Smith        with an optional dynamic library name, for example
2528ce4d24SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:mykspcreate()
2628ce4d24SBarry Smith 
2728ce4d24SBarry Smith    Level: beginner
2828ce4d24SBarry Smith 
2928ce4d24SBarry Smith .seealso: KSPSetType(), KSP
3028ce4d24SBarry Smith E*/
31a313700dSBarry Smith #define KSPType char*
3282bf6240SBarry Smith #define KSPRICHARDSON "richardson"
3382bf6240SBarry Smith #define KSPCHEBYCHEV  "chebychev"
3482bf6240SBarry Smith #define KSPCG         "cg"
35df2a969aSvictorle #define   KSPCGNE       "cgne"
36fcae7a14Stmunson #define   KSPNASH       "nash"
3780e17431SMatthew Knepley #define   KSPSTCG       "stcg"
388031f4adStmunson #define   KSPGLTR       "gltr"
3982bf6240SBarry Smith #define KSPGMRES      "gmres"
409dcbbd2bSBarry Smith #define   KSPFGMRES     "fgmres"
419dcbbd2bSBarry Smith #define   KSPLGMRES     "lgmres"
42*4f8e6cd9SSatish Balay #define KSPDGMRES     "dgmres"
4382bf6240SBarry Smith #define KSPTCQMR      "tcqmr"
4482bf6240SBarry Smith #define KSPBCGS       "bcgs"
45e1c61ce8SBarry Smith #define KSPIBCGS        "ibcgs"
46f0037002Svictorle #define KSPBCGSL        "bcgsl"
4782bf6240SBarry Smith #define KSPCGS        "cgs"
4882bf6240SBarry Smith #define KSPTFQMR      "tfqmr"
4982bf6240SBarry Smith #define KSPCR         "cr"
5082bf6240SBarry Smith #define KSPLSQR       "lsqr"
5182bf6240SBarry Smith #define KSPPREONLY    "preonly"
5282bf6240SBarry Smith #define KSPQCG        "qcg"
53c9cf9b11SBarry Smith #define KSPBICG       "bicg"
54b4ac9ba4SBarry Smith #define KSPMINRES     "minres"
5501c5daebSSatish Balay #define KSPSYMMLQ     "symmlq"
5621356919SSatish Balay #define KSPLCD        "lcd"
571d6018f0SLisandro Dalcin #define KSPPYTHON     "python"
589f6b3dcaSBarry Smith #define KSPBROYDEN    "broyden"
5958ad63f4SBarry Smith #define KSPGCR        "gcr"
607945016fSBarry Smith #define KSPNGMRES     "ngmres"
61bbce1389SJed Brown #define KSPSPECEST    "specest"
622eac72dbSBarry Smith 
638ba1e511SMatthew Knepley /* Logging support */
647087cfbeSBarry Smith extern PetscClassId  KSP_CLASSID;
658ba1e511SMatthew Knepley 
667087cfbeSBarry Smith extern PetscErrorCode  KSPCreate(MPI_Comm,KSP *);
677087cfbeSBarry Smith extern PetscErrorCode  KSPSetType(KSP,const KSPType);
687087cfbeSBarry Smith extern PetscErrorCode  KSPSetUp(KSP);
697087cfbeSBarry Smith extern PetscErrorCode  KSPSetUpOnBlocks(KSP);
707087cfbeSBarry Smith extern PetscErrorCode  KSPSolve(KSP,Vec,Vec);
717087cfbeSBarry Smith extern PetscErrorCode  KSPSolveTranspose(KSP,Vec,Vec);
72a293aec7SJed Brown extern PetscErrorCode  KSPReset(KSP);
73574deadeSBarry Smith extern PetscErrorCode  KSPDestroy_(KSP);
74574deadeSBarry Smith #define KSPDestroy(a)  (KSPDestroy_(a) || (((a) = 0),0))
752eac72dbSBarry Smith 
76b0a32e0cSBarry Smith extern PetscFList KSPList;
77ace3abfcSBarry Smith extern PetscBool  KSPRegisterAllCalled;
787087cfbeSBarry Smith extern PetscErrorCode  KSPRegisterAll(const char[]);
797087cfbeSBarry Smith extern PetscErrorCode  KSPRegisterDestroy(void);
807087cfbeSBarry Smith extern PetscErrorCode  KSPRegister(const char[],const char[],const char[],PetscErrorCode (*)(KSP));
8130de9b25SBarry Smith 
8230de9b25SBarry Smith /*MC
8330de9b25SBarry Smith    KSPRegisterDynamic - Adds a method to the Krylov subspace solver package.
8430de9b25SBarry Smith 
8530de9b25SBarry Smith    Synopsis:
861890ba74SBarry Smith    PetscErrorCode KSPRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(KSP))
8730de9b25SBarry Smith 
8830de9b25SBarry Smith    Not Collective
8930de9b25SBarry Smith 
9030de9b25SBarry Smith    Input Parameters:
9130de9b25SBarry Smith +  name_solver - name of a new user-defined solver
9230de9b25SBarry Smith .  path - path (either absolute or relative) the library containing this solver
9330de9b25SBarry Smith .  name_create - name of routine to create method context
9430de9b25SBarry Smith -  routine_create - routine to create method context
9530de9b25SBarry Smith 
9630de9b25SBarry Smith    Notes:
9730de9b25SBarry Smith    KSPRegisterDynamic() may be called multiple times to add several user-defined solvers.
9830de9b25SBarry Smith 
9930de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (routine_create)
10030de9b25SBarry Smith    is ignored.
10130de9b25SBarry Smith 
10230de9b25SBarry Smith    Sample usage:
10330de9b25SBarry Smith .vb
10430de9b25SBarry Smith    KSPRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a,
10530de9b25SBarry Smith                "MySolverCreate",MySolverCreate);
10630de9b25SBarry Smith .ve
10730de9b25SBarry Smith 
10830de9b25SBarry Smith    Then, your solver can be chosen with the procedural interface via
10930de9b25SBarry Smith $     KSPSetType(ksp,"my_solver")
11030de9b25SBarry Smith    or at runtime via the option
11130de9b25SBarry Smith $     -ksp_type my_solver
11230de9b25SBarry Smith 
11330de9b25SBarry Smith    Level: advanced
11430de9b25SBarry Smith 
115ab901514SBarry Smith    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
11630de9b25SBarry Smith           and others of the form ${any_environmental_variable} occuring in pathname will be
11730de9b25SBarry Smith           replaced with appropriate values.
11830de9b25SBarry Smith          If your function is not being put into a shared library then use KSPRegister() instead
11930de9b25SBarry Smith 
12030de9b25SBarry Smith .keywords: KSP, register
12130de9b25SBarry Smith 
12230de9b25SBarry Smith .seealso: KSPRegisterAll(), KSPRegisterDestroy()
12330de9b25SBarry Smith 
12430de9b25SBarry Smith M*/
125aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
126f1af5d2fSBarry Smith #define KSPRegisterDynamic(a,b,c,d) KSPRegister(a,b,c,0)
1276df38c32SLois Curfman McInnes #else
128f1af5d2fSBarry Smith #define KSPRegisterDynamic(a,b,c,d) KSPRegister(a,b,c,d)
1296df38c32SLois Curfman McInnes #endif
13082bf6240SBarry Smith 
1317087cfbeSBarry Smith extern PetscErrorCode  KSPGetType(KSP,const KSPType *);
1327087cfbeSBarry Smith extern PetscErrorCode  KSPSetPCSide(KSP,PCSide);
1337087cfbeSBarry Smith extern PetscErrorCode  KSPGetPCSide(KSP,PCSide*);
1347087cfbeSBarry Smith extern PetscErrorCode  KSPGetTolerances(KSP,PetscReal*,PetscReal*,PetscReal*,PetscInt*);
1357087cfbeSBarry Smith extern PetscErrorCode  KSPSetTolerances(KSP,PetscReal,PetscReal,PetscReal,PetscInt);
1367087cfbeSBarry Smith extern PetscErrorCode  KSPSetInitialGuessNonzero(KSP,PetscBool );
1377087cfbeSBarry Smith extern PetscErrorCode  KSPGetInitialGuessNonzero(KSP,PetscBool  *);
1387087cfbeSBarry Smith extern PetscErrorCode  KSPSetInitialGuessKnoll(KSP,PetscBool );
1397087cfbeSBarry Smith extern PetscErrorCode  KSPGetInitialGuessKnoll(KSP,PetscBool *);
1407087cfbeSBarry Smith extern PetscErrorCode  KSPSetErrorIfNotConverged(KSP,PetscBool );
1417087cfbeSBarry Smith extern PetscErrorCode  KSPGetErrorIfNotConverged(KSP,PetscBool  *);
1427087cfbeSBarry Smith extern PetscErrorCode  KSPGetComputeEigenvalues(KSP,PetscBool *);
1437087cfbeSBarry Smith extern PetscErrorCode  KSPSetComputeEigenvalues(KSP,PetscBool );
1447087cfbeSBarry Smith extern PetscErrorCode  KSPGetComputeSingularValues(KSP,PetscBool *);
1457087cfbeSBarry Smith extern PetscErrorCode  KSPSetComputeSingularValues(KSP,PetscBool );
1467087cfbeSBarry Smith extern PetscErrorCode  KSPGetRhs(KSP,Vec *);
1477087cfbeSBarry Smith extern PetscErrorCode  KSPGetSolution(KSP,Vec *);
1487087cfbeSBarry Smith extern PetscErrorCode  KSPGetResidualNorm(KSP,PetscReal*);
1497087cfbeSBarry Smith extern PetscErrorCode  KSPGetIterationNumber(KSP,PetscInt*);
1507087cfbeSBarry Smith extern PetscErrorCode  KSPSetNullSpace(KSP,MatNullSpace);
1517087cfbeSBarry Smith extern PetscErrorCode  KSPGetNullSpace(KSP,MatNullSpace*);
1527087cfbeSBarry Smith extern PetscErrorCode  KSPGetVecs(KSP,PetscInt,Vec**,PetscInt,Vec**);
1532eac72dbSBarry Smith 
1547087cfbeSBarry Smith extern PetscErrorCode  KSPSetPC(KSP,PC);
1557087cfbeSBarry Smith extern PetscErrorCode  KSPGetPC(KSP,PC*);
156aabeff55SBarry Smith 
1577087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorSet(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*),void *,PetscErrorCode (*)(void*));
1587087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorCancel(KSP);
1597087cfbeSBarry Smith extern PetscErrorCode  KSPGetMonitorContext(KSP,void **);
1607087cfbeSBarry Smith extern PetscErrorCode  KSPGetResidualHistory(KSP,PetscReal*[],PetscInt *);
1617087cfbeSBarry Smith extern PetscErrorCode  KSPSetResidualHistory(KSP,PetscReal[],PetscInt,PetscBool );
1624b0e389bSBarry Smith 
1630e33f6ddSBarry Smith /* not sure where to put this */
1647087cfbeSBarry Smith extern PetscErrorCode  PCKSPGetKSP(PC,KSP*);
1657087cfbeSBarry Smith extern PetscErrorCode  PCBJacobiGetSubKSP(PC,PetscInt*,PetscInt*,KSP*[]);
1667087cfbeSBarry Smith extern PetscErrorCode  PCASMGetSubKSP(PC,PetscInt*,PetscInt*,KSP*[]);
1677087cfbeSBarry Smith extern PetscErrorCode  PCGASMGetSubKSP(PC,PetscInt*,PetscInt*,KSP*[]);
1687087cfbeSBarry Smith extern PetscErrorCode  PCFieldSplitGetSubKSP(PC,PetscInt*,KSP*[]);
1692eac72dbSBarry Smith 
1707087cfbeSBarry Smith extern PetscErrorCode  PCGalerkinGetKSP(PC,KSP *);
1710a71e23eSMatthew Knepley 
1727087cfbeSBarry Smith extern PetscErrorCode  KSPBuildSolution(KSP,Vec,Vec *);
1737087cfbeSBarry Smith extern PetscErrorCode  KSPBuildResidual(KSP,Vec,Vec,Vec *);
1742eac72dbSBarry Smith 
1757087cfbeSBarry Smith extern PetscErrorCode  KSPRichardsonSetScale(KSP,PetscReal);
1767087cfbeSBarry Smith extern PetscErrorCode  KSPRichardsonSetSelfScale(KSP,PetscBool );
1777087cfbeSBarry Smith extern PetscErrorCode  KSPChebychevSetEigenvalues(KSP,PetscReal,PetscReal);
1787087cfbeSBarry Smith extern PetscErrorCode  KSPComputeExtremeSingularValues(KSP,PetscReal*,PetscReal*);
1797087cfbeSBarry Smith extern PetscErrorCode  KSPComputeEigenvalues(KSP,PetscInt,PetscReal*,PetscReal*,PetscInt *);
1807087cfbeSBarry Smith extern PetscErrorCode  KSPComputeEigenvaluesExplicitly(KSP,PetscInt,PetscReal*,PetscReal*);
1814b0e389bSBarry Smith 
1827087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetRestart(KSP, PetscInt);
1837087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESGetRestart(KSP, PetscInt*);
1847087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetHapTol(KSP,PetscReal);
1859f236934SBarry Smith 
1867087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetPreAllocateVectors(KSP);
1877087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetOrthogonalization(KSP,PetscErrorCode (*)(KSP,PetscInt));
1887087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESGetOrthogonalization(KSP,PetscErrorCode (**)(KSP,PetscInt));
1897087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESModifiedGramSchmidtOrthogonalization(KSP,PetscInt);
1907087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESClassicalGramSchmidtOrthogonalization(KSP,PetscInt);
1911d73ed98SBarry Smith 
1927087cfbeSBarry Smith extern PetscErrorCode  KSPLGMRESSetAugDim(KSP,PetscInt);
1937087cfbeSBarry Smith extern PetscErrorCode  KSPLGMRESSetConstant(KSP);
1941d73ed98SBarry Smith 
1957087cfbeSBarry Smith extern PetscErrorCode  KSPGCRSetRestart(KSP,PetscInt);
1967087cfbeSBarry Smith extern PetscErrorCode  KSPGCRGetRestart(KSP,PetscInt*);
1977087cfbeSBarry Smith extern PetscErrorCode  KSPGCRSetModifyPC(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*),void*,PetscErrorCode(*)(void*));
19858ad63f4SBarry Smith 
199b49fd9e1SBarry Smith /*E
200b49fd9e1SBarry Smith     KSPGMRESCGSRefinementType - How the classical (unmodified) Gram-Schmidt is performed.
201b49fd9e1SBarry Smith 
202b49fd9e1SBarry Smith    Level: advanced
203b49fd9e1SBarry Smith 
204bef9c725SBarry Smith .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(),
205e928de20SBarry Smith           KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSPGMRESModifiedGramSchmidtOrthogonalization()
206b49fd9e1SBarry Smith 
207b49fd9e1SBarry Smith E*/
20878d1dd23SKris Buschelman typedef enum {KSP_GMRES_CGS_REFINE_NEVER, KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS} KSPGMRESCGSRefinementType;
2099dcbbd2bSBarry Smith extern const char *KSPGMRESCGSRefinementTypes[];
2101f7e983dSSatish Balay /*MC
2118c5b8ba0SBarry Smith     KSP_GMRES_CGS_REFINE_NEVER - Just do the classical (unmodified) Gram-Schmidt process
2128c5b8ba0SBarry Smith 
2138c5b8ba0SBarry Smith    Level: advanced
2148c5b8ba0SBarry Smith 
2158c5b8ba0SBarry Smith    Note: Possible unstable, but the fastest to compute
2168c5b8ba0SBarry Smith 
217bef9c725SBarry Smith .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(),
218e928de20SBarry Smith           KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS,
2198c5b8ba0SBarry Smith           KSPGMRESModifiedGramSchmidtOrthogonalization()
2208c5b8ba0SBarry Smith M*/
2218c5b8ba0SBarry Smith 
2221f7e983dSSatish Balay /*MC
2238c5b8ba0SBarry Smith     KSP_GMRES_CGS_REFINE_IFNEEDED - Do the classical (unmodified) Gram-Schmidt process and one step of
2248c5b8ba0SBarry Smith           iterative refinement if an estimate of the orthogonality of the resulting vectors indicates
2258c5b8ba0SBarry Smith           poor orthogonality.
2268c5b8ba0SBarry Smith 
2278c5b8ba0SBarry Smith    Level: advanced
2288c5b8ba0SBarry Smith 
2298c5b8ba0SBarry Smith    Note: This is slower than KSP_GMRES_CGS_REFINE_NEVER because it requires an extra norm computation to
2308c5b8ba0SBarry Smith      estimate the orthogonality but is more stable.
2318c5b8ba0SBarry Smith 
232bef9c725SBarry Smith .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(),
233e928de20SBarry Smith           KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSP_GMRES_CGS_REFINE_NEVER, KSP_GMRES_CGS_REFINE_ALWAYS,
2348c5b8ba0SBarry Smith           KSPGMRESModifiedGramSchmidtOrthogonalization()
2358c5b8ba0SBarry Smith M*/
2368c5b8ba0SBarry Smith 
2371f7e983dSSatish Balay /*MC
2388c5b8ba0SBarry Smith     KSP_GMRES_CGS_REFINE_NEVER - Do two steps of the classical (unmodified) Gram-Schmidt process.
2398c5b8ba0SBarry Smith 
2408c5b8ba0SBarry Smith    Level: advanced
2418c5b8ba0SBarry Smith 
2428c5b8ba0SBarry Smith    Note: This is roughly twice the cost of KSP_GMRES_CGS_REFINE_NEVER because it performs the process twice
2438c5b8ba0SBarry Smith      but it saves the extra norm calculation needed by KSP_GMRES_CGS_REFINE_IFNEEDED.
2448c5b8ba0SBarry Smith 
2458c5b8ba0SBarry Smith         You should only use this if you absolutely know that the iterative refinement is needed.
2468c5b8ba0SBarry Smith 
247bef9c725SBarry Smith .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(),
248e928de20SBarry Smith           KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS,
2498c5b8ba0SBarry Smith           KSPGMRESModifiedGramSchmidtOrthogonalization()
2508c5b8ba0SBarry Smith M*/
2518c5b8ba0SBarry Smith 
2527087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetCGSRefinementType(KSP,KSPGMRESCGSRefinementType);
2537087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESGetCGSRefinementType(KSP,KSPGMRESCGSRefinementType*);
25408480c60SBarry Smith 
2557087cfbeSBarry Smith extern PetscErrorCode  KSPFGMRESModifyPCNoChange(KSP,PetscInt,PetscInt,PetscReal,void*);
2567087cfbeSBarry Smith extern PetscErrorCode  KSPFGMRESModifyPCKSP(KSP,PetscInt,PetscInt,PetscReal,void*);
2577087cfbeSBarry Smith extern PetscErrorCode  KSPFGMRESSetModifyPC(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscInt,PetscReal,void*),void*,PetscErrorCode(*)(void*));
258c38d4ed2SBarry Smith 
2597087cfbeSBarry Smith extern PetscErrorCode  KSPQCGSetTrustRegionRadius(KSP,PetscReal);
2607087cfbeSBarry Smith extern PetscErrorCode  KSPQCGGetQuadratic(KSP,PetscReal*);
2617087cfbeSBarry Smith extern PetscErrorCode  KSPQCGGetTrialStepNorm(KSP,PetscReal*);
262121fd945SKris Buschelman 
2637087cfbeSBarry Smith extern PetscErrorCode  KSPBCGSLSetXRes(KSP,PetscReal);
2647087cfbeSBarry Smith extern PetscErrorCode  KSPBCGSLSetPol(KSP,PetscBool );
2657087cfbeSBarry Smith extern PetscErrorCode  KSPBCGSLSetEll(KSP,PetscInt);
266d9492815SBarry Smith 
2677087cfbeSBarry Smith extern PetscErrorCode  KSPSetFromOptions(KSP);
2687087cfbeSBarry Smith extern PetscErrorCode  KSPAddOptionsChecker(PetscErrorCode (*)(KSP));
2692eac72dbSBarry Smith 
2707087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorSingularValue(KSP,PetscInt,PetscReal,void *);
2717087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorDefault(KSP,PetscInt,PetscReal,void *);
2727087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorDefaultLSQR(KSP,PetscInt,PetscReal,void *);
2737087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorRange(KSP,PetscInt,PetscReal,void *);
2747087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorTrueResidualNorm(KSP,PetscInt,PetscReal,void *);
2757087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorDefaultShort(KSP,PetscInt,PetscReal,void *);
2767087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorSolution(KSP,PetscInt,PetscReal,void *);
2777087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESMonitorKrylov(KSP,PetscInt,PetscReal,void *);
27884cb2905SBarry Smith 
2797087cfbeSBarry Smith extern PetscErrorCode  KSPUnwindPreconditioner(KSP,Vec,Vec);
2807087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultBuildSolution(KSP,Vec,Vec*);
2817087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultBuildResidual(KSP,Vec,Vec,Vec *);
2827087cfbeSBarry Smith extern PetscErrorCode  KSPInitialResidual(KSP,Vec,Vec,Vec,Vec,Vec);
283c01c455dSBarry Smith 
2847087cfbeSBarry Smith extern PetscErrorCode  KSPSetOperators(KSP,Mat,Mat,MatStructure);
2857087cfbeSBarry Smith extern PetscErrorCode  KSPGetOperators(KSP,Mat*,Mat*,MatStructure*);
2867087cfbeSBarry Smith extern PetscErrorCode  KSPGetOperatorsSet(KSP,PetscBool *,PetscBool *);
2877087cfbeSBarry Smith extern PetscErrorCode  KSPSetOptionsPrefix(KSP,const char[]);
2887087cfbeSBarry Smith extern PetscErrorCode  KSPAppendOptionsPrefix(KSP,const char[]);
2897087cfbeSBarry Smith extern PetscErrorCode  KSPGetOptionsPrefix(KSP,const char*[]);
2901eb62cbbSBarry Smith 
2917087cfbeSBarry Smith extern PetscErrorCode  KSPSetDiagonalScale(KSP,PetscBool );
2927087cfbeSBarry Smith extern PetscErrorCode  KSPGetDiagonalScale(KSP,PetscBool *);
2937087cfbeSBarry Smith extern PetscErrorCode  KSPSetDiagonalScaleFix(KSP,PetscBool );
2947087cfbeSBarry Smith extern PetscErrorCode  KSPGetDiagonalScaleFix(KSP,PetscBool *);
2951f7f0c4fSBarry Smith 
2967087cfbeSBarry Smith extern PetscErrorCode  KSPView(KSP,PetscViewer);
2971eb62cbbSBarry Smith 
2987087cfbeSBarry Smith extern PetscErrorCode  KSPLSQRSetStandardErrorVec(KSP,Vec);
2997087cfbeSBarry Smith extern PetscErrorCode  KSPLSQRGetStandardErrorVec(KSP,Vec*);
300db9b2ab1SHong Zhang 
30183ab6a24SBarry Smith extern PetscErrorCode  PCRedundantGetKSP(PC,KSP*);
3025e7ef714SBarry Smith extern PetscErrorCode  PCRedistributeGetKSP(PC,KSP*);
30383ab6a24SBarry Smith 
30428ce4d24SBarry Smith /*E
3058a4b9c5cSBarry Smith     KSPNormType - Norm that is passed in the Krylov convergence
3068a4b9c5cSBarry Smith        test routines.
3078a4b9c5cSBarry Smith 
3088a4b9c5cSBarry Smith    Level: advanced
3098a4b9c5cSBarry Smith 
310a3f661c8SBarry Smith    Each solver only supports a subset of these and some may support different ones
3111718446fSBarry Smith    depending on left or right preconditioning, see KSPSetPCSide()
312a3f661c8SBarry Smith 
3138a4b9c5cSBarry Smith    Notes: this must match finclude/petscksp.h
3148a4b9c5cSBarry Smith 
31594b7f48cSBarry Smith .seealso: KSPSolve(), KSPGetConvergedReason(), KSPSetNormType(),
3161718446fSBarry Smith           KSPSetConvergenceTest(), KSPSetPCSide()
3178a4b9c5cSBarry Smith E*/
3189793b452SBarry Smith typedef enum {KSP_NORM_NONE = 0,KSP_NORM_PRECONDITIONED = 1,KSP_NORM_UNPRECONDITIONED = 2,KSP_NORM_NATURAL = 3} KSPNormType;
3199dcbbd2bSBarry Smith extern const char *KSPNormTypes[];
3201f7e983dSSatish Balay /*MC
3219793b452SBarry Smith     KSP_NORM_NONE - Do not compute a norm during the Krylov process. This will
3228c5b8ba0SBarry Smith           possibly save some computation but means the convergence test cannot
3238c5b8ba0SBarry Smith           be based on a norm of a residual etc.
3248c5b8ba0SBarry Smith 
3258c5b8ba0SBarry Smith    Level: advanced
3268c5b8ba0SBarry Smith 
327085a36d4SBarry Smith     Note: Some Krylov methods need to compute a residual norm and then this option is ignored
3288c5b8ba0SBarry Smith 
329ce9499c7SBarry Smith .seealso: KSPNormType, KSPSetNormType(), KSP_NORM_PRECONDITIONED, KSP_NORM_UNPRECONDITIONED, KSP_NORM_NATURAL
3308c5b8ba0SBarry Smith M*/
3318c5b8ba0SBarry Smith 
3321f7e983dSSatish Balay /*MC
333ce9499c7SBarry Smith     KSP_NORM_PRECONDITIONED - Compute the norm of the preconditioned residual and pass that to the
3348c5b8ba0SBarry Smith        convergence test routine.
3358c5b8ba0SBarry Smith 
3368c5b8ba0SBarry Smith    Level: advanced
3378c5b8ba0SBarry Smith 
3389793b452SBarry Smith .seealso: KSPNormType, KSPSetNormType(), KSP_NORM_NONE, KSP_NORM_UNPRECONDITIONED, KSP_NORM_NATURAL, KSPSetConvergenceTest()
3398c5b8ba0SBarry Smith M*/
3408c5b8ba0SBarry Smith 
3411f7e983dSSatish Balay /*MC
342ce9499c7SBarry Smith     KSP_NORM_UNPRECONDITIONED - Compute the norm of the true residual (b - A*x) and pass that to the
3438c5b8ba0SBarry Smith        convergence test routine.
3448c5b8ba0SBarry Smith 
3458c5b8ba0SBarry Smith    Level: advanced
3468c5b8ba0SBarry Smith 
3479793b452SBarry Smith .seealso: KSPNormType, KSPSetNormType(), KSP_NORM_NONE, KSP_NORM_PRECONDITIONED, KSP_NORM_NATURAL, KSPSetConvergenceTest()
3488c5b8ba0SBarry Smith M*/
3498c5b8ba0SBarry Smith 
3501f7e983dSSatish Balay /*MC
351ce9499c7SBarry Smith     KSP_NORM_NATURAL - Compute the 'natural norm' of residual sqrt((b - A*x)*B*(b - A*x)) and pass that to the
352a3f661c8SBarry Smith        convergence test routine. This is only supported by  KSPCG, KSPCR, KSPCGNE, KSPCGS
3538c5b8ba0SBarry Smith 
3548c5b8ba0SBarry Smith    Level: advanced
3558c5b8ba0SBarry Smith 
3569793b452SBarry Smith .seealso: KSPNormType, KSPSetNormType(), KSP_NORM_NONE, KSP_NORM_PRECONDITIONED, KSP_NORM_UNPRECONDITIONED, KSPSetConvergenceTest()
3578c5b8ba0SBarry Smith M*/
3588c5b8ba0SBarry Smith 
3597087cfbeSBarry Smith extern PetscErrorCode  KSPSetNormType(KSP,KSPNormType);
3607087cfbeSBarry Smith extern PetscErrorCode  KSPGetNormType(KSP,KSPNormType*);
3617087cfbeSBarry Smith extern PetscErrorCode  KSPSetCheckNormIteration(KSP,PetscInt);
3627087cfbeSBarry Smith extern PetscErrorCode  KSPSetLagNorm(KSP,PetscBool );
3638a4b9c5cSBarry Smith 
3648a4b9c5cSBarry Smith /*E
36528ce4d24SBarry Smith     KSPConvergedReason - reason a Krylov method was said to
36628ce4d24SBarry Smith          have converged or diverged
36728ce4d24SBarry Smith 
36828ce4d24SBarry Smith    Level: beginner
36928ce4d24SBarry Smith 
3704d0a8057SBarry Smith    Notes: See KSPGetConvergedReason() for explanation of each value
37128ce4d24SBarry Smith 
3724d0a8057SBarry Smith    Developer notes: this must match finclude/petscksp.h
3734d0a8057SBarry Smith 
3744d0a8057SBarry Smith       The string versions of these are KSPConvergedReasons; if you change
3754d0a8057SBarry Smith       any of the values here also change them that array of names.
37686c02ca4SBarry Smith 
377c838673bSBarry Smith .seealso: KSPSolve(), KSPGetConvergedReason(), KSPSetTolerances()
37828ce4d24SBarry Smith E*/
379d15094e1SBarry Smith typedef enum {/* converged */
3809ecb1286SBarry Smith               KSP_CONVERGED_RTOL_NORMAL        =  1,
3819ecb1286SBarry Smith               KSP_CONVERGED_ATOL_NORMAL        =  9,
382d15094e1SBarry Smith               KSP_CONVERGED_RTOL               =  2,
383d15094e1SBarry Smith               KSP_CONVERGED_ATOL               =  3,
384b335793eSSatish Balay               KSP_CONVERGED_ITS                =  4,
3858031f4adStmunson               KSP_CONVERGED_CG_NEG_CURVE       =  5,
3868031f4adStmunson               KSP_CONVERGED_CG_CONSTRAINED     =  6,
387329f5518SBarry Smith               KSP_CONVERGED_STEP_LENGTH        =  7,
388af3d8002SBarry Smith               KSP_CONVERGED_HAPPY_BREAKDOWN    =  8,
389d15094e1SBarry Smith               /* diverged */
390b3cc6726SBarry Smith               KSP_DIVERGED_NULL                = -2,
391d15094e1SBarry Smith               KSP_DIVERGED_ITS                 = -3,
392d15094e1SBarry Smith               KSP_DIVERGED_DTOL                = -4,
393d15094e1SBarry Smith               KSP_DIVERGED_BREAKDOWN           = -5,
394b4ac9ba4SBarry Smith               KSP_DIVERGED_BREAKDOWN_BICG      = -6,
395b4ac9ba4SBarry Smith               KSP_DIVERGED_NONSYMMETRIC        = -7,
396b4ac9ba4SBarry Smith               KSP_DIVERGED_INDEFINITE_PC       = -8,
3976aee1118SBarry Smith               KSP_DIVERGED_NAN                 = -9,
3986aee1118SBarry Smith               KSP_DIVERGED_INDEFINITE_MAT      = -10,
399d15094e1SBarry Smith 
400d15094e1SBarry Smith               KSP_CONVERGED_ITERATING          =  0} KSPConvergedReason;
4017935a769SJed Brown extern const char *const*KSPConvergedReasons;
402d15094e1SBarry Smith 
403c838673bSBarry Smith /*MC
404c838673bSBarry Smith      KSP_CONVERGED_RTOL - norm(r) <= rtol*norm(b)
405c838673bSBarry Smith 
406c838673bSBarry Smith    Level: beginner
407c838673bSBarry Smith 
408c838673bSBarry Smith    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
409c838673bSBarry Smith        for left preconditioning it is the 2-norm of the preconditioned residual, and the
410c838673bSBarry Smith        2-norm of the residual for right preconditioning
411c838673bSBarry Smith 
412c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
413c838673bSBarry Smith 
414c838673bSBarry Smith M*/
415c838673bSBarry Smith 
416c838673bSBarry Smith /*MC
417c838673bSBarry Smith      KSP_CONVERGED_ATOL - norm(r) <= atol
418c838673bSBarry Smith 
419c838673bSBarry Smith    Level: beginner
420c838673bSBarry Smith 
421c838673bSBarry Smith    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
422c838673bSBarry Smith        for left preconditioning it is the 2-norm of the preconditioned residual, and the
423c838673bSBarry Smith        2-norm of the residual for right preconditioning
424c838673bSBarry Smith 
425c838673bSBarry Smith    Level: beginner
426c838673bSBarry Smith 
427c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
428c838673bSBarry Smith 
429c838673bSBarry Smith M*/
430c838673bSBarry Smith 
431c838673bSBarry Smith /*MC
432c838673bSBarry Smith      KSP_DIVERGED_DTOL - norm(r) >= dtol*norm(b)
433c838673bSBarry Smith 
434c838673bSBarry Smith    Level: beginner
435c838673bSBarry Smith 
436c838673bSBarry Smith    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
437c838673bSBarry Smith        for left preconditioning it is the 2-norm of the preconditioned residual, and the
438c838673bSBarry Smith        2-norm of the residual for right preconditioning
439c838673bSBarry Smith 
440c838673bSBarry Smith    Level: beginner
441c838673bSBarry Smith 
442c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
443c838673bSBarry Smith 
444c838673bSBarry Smith M*/
445c838673bSBarry Smith 
446c838673bSBarry Smith /*MC
447c838673bSBarry Smith      KSP_DIVERGED_ITS - Ran out of iterations before any convergence criteria was
448c838673bSBarry Smith       reached
449c838673bSBarry Smith 
450c838673bSBarry Smith    Level: beginner
451c838673bSBarry Smith 
452c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
453c838673bSBarry Smith 
454c838673bSBarry Smith M*/
455c838673bSBarry Smith 
456c838673bSBarry Smith /*MC
4578c9406f6SLisandro Dalcin      KSP_CONVERGED_ITS - Used by the KSPPREONLY solver after the single iteration of
4588c9406f6SLisandro Dalcin            the preconditioner is applied. Also used when the KSPSkipConverged() convergence
4594d0a8057SBarry Smith            test routine is set in KSP.
460c838673bSBarry Smith 
461c838673bSBarry Smith 
462c838673bSBarry Smith    Level: beginner
463c838673bSBarry Smith 
464c838673bSBarry Smith 
465c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
466c838673bSBarry Smith 
467c838673bSBarry Smith M*/
468c838673bSBarry Smith 
469c838673bSBarry Smith /*MC
470c838673bSBarry Smith      KSP_DIVERGED_BREAKDOWN - A breakdown in the Krylov method was detected so the
4713014e516SBarry Smith           method could not continue to enlarge the Krylov space. Could be due to a singlular matrix or
4723014e516SBarry Smith           preconditioner.
473c838673bSBarry Smith 
474c838673bSBarry Smith    Level: beginner
475c838673bSBarry Smith 
476c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
477c838673bSBarry Smith 
478c838673bSBarry Smith M*/
479c838673bSBarry Smith 
480c838673bSBarry Smith /*MC
481c838673bSBarry Smith      KSP_DIVERGED_BREAKDOWN_BICG - A breakdown in the KSPBICG method was detected so the
482c838673bSBarry Smith           method could not continue to enlarge the Krylov space.
483c838673bSBarry Smith 
484c838673bSBarry Smith 
485c838673bSBarry Smith    Level: beginner
486c838673bSBarry Smith 
487c838673bSBarry Smith 
488c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
489c838673bSBarry Smith 
490c838673bSBarry Smith M*/
491c838673bSBarry Smith 
492c838673bSBarry Smith /*MC
493c838673bSBarry Smith      KSP_DIVERGED_NONSYMMETRIC - It appears the operator or preconditioner is not
494c838673bSBarry Smith         symmetric and this Krylov method (KSPCG, KSPMINRES, KSPCR) requires symmetry
495c838673bSBarry Smith 
496c838673bSBarry Smith    Level: beginner
497c838673bSBarry Smith 
498c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
499c838673bSBarry Smith 
500c838673bSBarry Smith M*/
501c838673bSBarry Smith 
502c838673bSBarry Smith /*MC
503c838673bSBarry Smith      KSP_DIVERGED_INDEFINITE_PC - It appears the preconditioner is indefinite (has both
504c838673bSBarry Smith         positive and negative eigenvalues) and this Krylov method (KSPCG) requires it to
505c838673bSBarry Smith         be positive definite
506c838673bSBarry Smith 
507c838673bSBarry Smith    Level: beginner
508c838673bSBarry Smith 
5092401956bSBarry Smith      Notes: This can happen with the PCICC preconditioner, use -pc_factor_shift_positive_definite to force
510c838673bSBarry Smith   the PCICC preconditioner to generate a positive definite preconditioner
511c838673bSBarry Smith 
512c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
513c838673bSBarry Smith 
514c838673bSBarry Smith M*/
515c838673bSBarry Smith 
516c838673bSBarry Smith /*MC
517c838673bSBarry Smith      KSP_CONVERGED_ITERATING - This flag is returned if you call KSPGetConvergedReason()
518c838673bSBarry Smith         while the KSPSolve() is still running.
519c838673bSBarry Smith 
520c838673bSBarry Smith    Level: beginner
521c838673bSBarry Smith 
522c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
523c838673bSBarry Smith 
524c838673bSBarry Smith M*/
525c838673bSBarry Smith 
5267087cfbeSBarry Smith extern PetscErrorCode  KSPSetConvergenceTest(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscReal,KSPConvergedReason*,void*),void *,PetscErrorCode (*)(void*));
5277087cfbeSBarry Smith extern PetscErrorCode  KSPGetConvergenceContext(KSP,void **);
5287087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConverged(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
5297087cfbeSBarry Smith extern PetscErrorCode  KSPConvergedLSQR(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
5307087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConvergedDestroy(void *);
5317087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConvergedCreate(void **);
5327087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConvergedSetUIRNorm(KSP);
5337087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConvergedSetUMIRNorm(KSP);
5347087cfbeSBarry Smith extern PetscErrorCode  KSPSkipConverged(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
5357087cfbeSBarry Smith extern PetscErrorCode  KSPGetConvergedReason(KSP,KSPConvergedReason *);
536abef13c0SSatish Balay 
5377087cfbeSBarry Smith extern PetscErrorCode  KSPComputeExplicitOperator(KSP,Mat *);
538d4fbbf0eSBarry Smith 
53928ce4d24SBarry Smith /*E
54028ce4d24SBarry Smith     KSPCGType - Determines what type of CG to use
54128ce4d24SBarry Smith 
54228ce4d24SBarry Smith    Level: beginner
54328ce4d24SBarry Smith 
54428ce4d24SBarry Smith .seealso: KSPCGSetType()
54528ce4d24SBarry Smith E*/
5469dcbbd2bSBarry Smith typedef enum {KSP_CG_SYMMETRIC=0,KSP_CG_HERMITIAN=1} KSPCGType;
5479dcbbd2bSBarry Smith extern const char *KSPCGTypes[];
54828ce4d24SBarry Smith 
5497087cfbeSBarry Smith extern PetscErrorCode  KSPCGSetType(KSP,KSPCGType);
5507087cfbeSBarry Smith extern PetscErrorCode  KSPCGUseSingleReduction(KSP,PetscBool );
5518031f4adStmunson 
5527087cfbeSBarry Smith extern PetscErrorCode  KSPNASHSetRadius(KSP,PetscReal);
5537087cfbeSBarry Smith extern PetscErrorCode  KSPNASHGetNormD(KSP,PetscReal *);
5547087cfbeSBarry Smith extern PetscErrorCode  KSPNASHGetObjFcn(KSP,PetscReal *);
555fcae7a14Stmunson 
5567087cfbeSBarry Smith extern PetscErrorCode  KSPSTCGSetRadius(KSP,PetscReal);
5577087cfbeSBarry Smith extern PetscErrorCode  KSPSTCGGetNormD(KSP,PetscReal *);
5587087cfbeSBarry Smith extern PetscErrorCode  KSPSTCGGetObjFcn(KSP,PetscReal *);
559e559a7feSLois Curfman McInnes 
5607087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRSetRadius(KSP,PetscReal);
5617087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRGetNormD(KSP,PetscReal *);
5627087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRGetObjFcn(KSP,PetscReal *);
5637087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRGetMinEig(KSP,PetscReal *);
5647087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRGetLambda(KSP,PetscReal *);
5658031f4adStmunson 
5667087cfbeSBarry Smith extern PetscErrorCode  KSPPythonSetType(KSP,const char[]);
5671d6018f0SLisandro Dalcin 
5687087cfbeSBarry Smith extern PetscErrorCode  PCPreSolve(PC,KSP);
5697087cfbeSBarry Smith extern PetscErrorCode  PCPostSolve(PC,KSP);
5703369ce9aSBarry Smith 
5717087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGCreate(const char[],const char[],int,int,int,int,PetscDrawLG*);
5727087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLG(KSP,PetscInt,PetscReal,void*);
5737087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGDestroy(PetscDrawLG);
5747087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGTrueResidualNormCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscDrawLG*);
5757087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGTrueResidualNorm(KSP,PetscInt,PetscReal,void*);
5767087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGTrueResidualNormDestroy(PetscDrawLG);
5777087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGRangeCreate(const char[],const char[],int,int,int,int,PetscDrawLG*);
5787087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGRange(KSP,PetscInt,PetscReal,void*);
5797087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGRangeDestroy(PetscDrawLG);
5802f2e5d10SKris Buschelman 
5817087cfbeSBarry Smith extern PetscErrorCode  PCShellSetPreSolve(PC,PetscErrorCode (*)(PC,KSP,Vec,Vec));
5827087cfbeSBarry Smith extern PetscErrorCode  PCShellSetPostSolve(PC,PetscErrorCode (*)(PC,KSP,Vec,Vec));
58303919abeSBarry Smith 
584f8a50e2bSBarry Smith /* see src/ksp/ksp/interface/iguess.c */
585ace3abfcSBarry Smith typedef struct _p_KSPFischerGuess {PetscInt method,curl,maxl,refcnt;PetscBool  monitor;Mat mat; KSP ksp;}* KSPFischerGuess;
586f8a50e2bSBarry Smith 
5877087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessCreate(KSP,PetscInt,PetscInt,KSPFischerGuess*);
5887867f5c6SBarry Smith extern PetscErrorCode  KSPFischerGuessDestroy(KSPFischerGuess*);
5897087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessReset(KSPFischerGuess);
5907087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessUpdate(KSPFischerGuess,Vec);
5917087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessFormGuess(KSPFischerGuess,Vec,Vec);
5927087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessSetFromOptions(KSPFischerGuess);
593f8a50e2bSBarry Smith 
5947087cfbeSBarry Smith extern PetscErrorCode  KSPSetUseFischerGuess(KSP,PetscInt,PetscInt);
5957087cfbeSBarry Smith extern PetscErrorCode  KSPSetFischerGuess(KSP,KSPFischerGuess);
5967087cfbeSBarry Smith extern PetscErrorCode  KSPGetFischerGuess(KSP,KSPFischerGuess*);
597f8a50e2bSBarry Smith 
5987087cfbeSBarry Smith extern PetscErrorCode  MatCreateSchurComplement(Mat,Mat,Mat,Mat,Mat,Mat*);
5997087cfbeSBarry Smith extern PetscErrorCode  MatSchurComplementGetKSP(Mat,KSP*);
6007087cfbeSBarry Smith extern PetscErrorCode  MatSchurComplementUpdate(Mat,Mat,Mat,Mat,Mat,Mat,MatStructure);
6017087cfbeSBarry Smith extern PetscErrorCode  MatSchurComplementGetSubmatrices(Mat,Mat*,Mat*,Mat*,Mat*,Mat*);
6027087cfbeSBarry Smith extern PetscErrorCode  MatGetSchurComplement(Mat,IS,IS,IS,IS,MatReuse,Mat *,MatReuse,Mat *);
6033f22127dSBarry Smith 
6047087cfbeSBarry Smith extern PetscErrorCode  KSPSetDM(KSP,DM);
6057087cfbeSBarry Smith extern PetscErrorCode  KSPSetDMActive(KSP,PetscBool );
6067087cfbeSBarry Smith extern PetscErrorCode  KSPGetDM(KSP,DM*);
6076c699258SBarry Smith 
608e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END
6092eac72dbSBarry Smith #endif
610