xref: /petsc/include/petscksp.h (revision 61b468f9a16d34a45feb58589e9aa802fb51dcf6)
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 
2276bdecfbSBarry Smith /*J
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
3076bdecfbSBarry Smith J*/
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"
424f8e6cd9SSatish Balay #define   KSPDGMRES     "dgmres"
43*61b468f9SJed Brown #define   KSPPGMRES     "pgmres"
4482bf6240SBarry Smith #define KSPTCQMR      "tcqmr"
4582bf6240SBarry Smith #define KSPBCGS       "bcgs"
46e1c61ce8SBarry Smith #define KSPIBCGS        "ibcgs"
47f0037002Svictorle #define KSPBCGSL        "bcgsl"
4882bf6240SBarry Smith #define KSPCGS        "cgs"
4982bf6240SBarry Smith #define KSPTFQMR      "tfqmr"
5082bf6240SBarry Smith #define KSPCR         "cr"
5182bf6240SBarry Smith #define KSPLSQR       "lsqr"
5282bf6240SBarry Smith #define KSPPREONLY    "preonly"
5382bf6240SBarry Smith #define KSPQCG        "qcg"
54c9cf9b11SBarry Smith #define KSPBICG       "bicg"
55b4ac9ba4SBarry Smith #define KSPMINRES     "minres"
5601c5daebSSatish Balay #define KSPSYMMLQ     "symmlq"
5721356919SSatish Balay #define KSPLCD        "lcd"
581d6018f0SLisandro Dalcin #define KSPPYTHON     "python"
599f6b3dcaSBarry Smith #define KSPBROYDEN    "broyden"
6058ad63f4SBarry Smith #define KSPGCR        "gcr"
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);
73fcfd50ebSBarry Smith extern PetscErrorCode  KSPDestroy(KSP*);
742eac72dbSBarry Smith 
75b0a32e0cSBarry Smith extern PetscFList KSPList;
76ace3abfcSBarry Smith extern PetscBool  KSPRegisterAllCalled;
777087cfbeSBarry Smith extern PetscErrorCode  KSPRegisterAll(const char[]);
787087cfbeSBarry Smith extern PetscErrorCode  KSPRegisterDestroy(void);
797087cfbeSBarry Smith extern PetscErrorCode  KSPRegister(const char[],const char[],const char[],PetscErrorCode (*)(KSP));
8030de9b25SBarry Smith 
8130de9b25SBarry Smith /*MC
8230de9b25SBarry Smith    KSPRegisterDynamic - Adds a method to the Krylov subspace solver package.
8330de9b25SBarry Smith 
8430de9b25SBarry Smith    Synopsis:
851890ba74SBarry Smith    PetscErrorCode KSPRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(KSP))
8630de9b25SBarry Smith 
8730de9b25SBarry Smith    Not Collective
8830de9b25SBarry Smith 
8930de9b25SBarry Smith    Input Parameters:
9030de9b25SBarry Smith +  name_solver - name of a new user-defined solver
9130de9b25SBarry Smith .  path - path (either absolute or relative) the library containing this solver
9230de9b25SBarry Smith .  name_create - name of routine to create method context
9330de9b25SBarry Smith -  routine_create - routine to create method context
9430de9b25SBarry Smith 
9530de9b25SBarry Smith    Notes:
9630de9b25SBarry Smith    KSPRegisterDynamic() may be called multiple times to add several user-defined solvers.
9730de9b25SBarry Smith 
9830de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (routine_create)
9930de9b25SBarry Smith    is ignored.
10030de9b25SBarry Smith 
10130de9b25SBarry Smith    Sample usage:
10230de9b25SBarry Smith .vb
10330de9b25SBarry Smith    KSPRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a,
10430de9b25SBarry Smith                "MySolverCreate",MySolverCreate);
10530de9b25SBarry Smith .ve
10630de9b25SBarry Smith 
10730de9b25SBarry Smith    Then, your solver can be chosen with the procedural interface via
10830de9b25SBarry Smith $     KSPSetType(ksp,"my_solver")
10930de9b25SBarry Smith    or at runtime via the option
11030de9b25SBarry Smith $     -ksp_type my_solver
11130de9b25SBarry Smith 
11230de9b25SBarry Smith    Level: advanced
11330de9b25SBarry Smith 
114ab901514SBarry Smith    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
11530de9b25SBarry Smith           and others of the form ${any_environmental_variable} occuring in pathname will be
11630de9b25SBarry Smith           replaced with appropriate values.
11730de9b25SBarry Smith          If your function is not being put into a shared library then use KSPRegister() instead
11830de9b25SBarry Smith 
11930de9b25SBarry Smith .keywords: KSP, register
12030de9b25SBarry Smith 
12130de9b25SBarry Smith .seealso: KSPRegisterAll(), KSPRegisterDestroy()
12230de9b25SBarry Smith 
12330de9b25SBarry Smith M*/
124aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
125f1af5d2fSBarry Smith #define KSPRegisterDynamic(a,b,c,d) KSPRegister(a,b,c,0)
1266df38c32SLois Curfman McInnes #else
127f1af5d2fSBarry Smith #define KSPRegisterDynamic(a,b,c,d) KSPRegister(a,b,c,d)
1286df38c32SLois Curfman McInnes #endif
12982bf6240SBarry Smith 
1307087cfbeSBarry Smith extern PetscErrorCode  KSPGetType(KSP,const KSPType *);
1317087cfbeSBarry Smith extern PetscErrorCode  KSPSetPCSide(KSP,PCSide);
1327087cfbeSBarry Smith extern PetscErrorCode  KSPGetPCSide(KSP,PCSide*);
1337087cfbeSBarry Smith extern PetscErrorCode  KSPGetTolerances(KSP,PetscReal*,PetscReal*,PetscReal*,PetscInt*);
1347087cfbeSBarry Smith extern PetscErrorCode  KSPSetTolerances(KSP,PetscReal,PetscReal,PetscReal,PetscInt);
1357087cfbeSBarry Smith extern PetscErrorCode  KSPSetInitialGuessNonzero(KSP,PetscBool );
1367087cfbeSBarry Smith extern PetscErrorCode  KSPGetInitialGuessNonzero(KSP,PetscBool  *);
1377087cfbeSBarry Smith extern PetscErrorCode  KSPSetInitialGuessKnoll(KSP,PetscBool );
1387087cfbeSBarry Smith extern PetscErrorCode  KSPGetInitialGuessKnoll(KSP,PetscBool *);
1397087cfbeSBarry Smith extern PetscErrorCode  KSPSetErrorIfNotConverged(KSP,PetscBool );
1407087cfbeSBarry Smith extern PetscErrorCode  KSPGetErrorIfNotConverged(KSP,PetscBool  *);
1417087cfbeSBarry Smith extern PetscErrorCode  KSPGetComputeEigenvalues(KSP,PetscBool *);
1427087cfbeSBarry Smith extern PetscErrorCode  KSPSetComputeEigenvalues(KSP,PetscBool );
1437087cfbeSBarry Smith extern PetscErrorCode  KSPGetComputeSingularValues(KSP,PetscBool *);
1447087cfbeSBarry Smith extern PetscErrorCode  KSPSetComputeSingularValues(KSP,PetscBool );
1457087cfbeSBarry Smith extern PetscErrorCode  KSPGetRhs(KSP,Vec *);
1467087cfbeSBarry Smith extern PetscErrorCode  KSPGetSolution(KSP,Vec *);
1477087cfbeSBarry Smith extern PetscErrorCode  KSPGetResidualNorm(KSP,PetscReal*);
1487087cfbeSBarry Smith extern PetscErrorCode  KSPGetIterationNumber(KSP,PetscInt*);
1497087cfbeSBarry Smith extern PetscErrorCode  KSPSetNullSpace(KSP,MatNullSpace);
1507087cfbeSBarry Smith extern PetscErrorCode  KSPGetNullSpace(KSP,MatNullSpace*);
1517087cfbeSBarry Smith extern PetscErrorCode  KSPGetVecs(KSP,PetscInt,Vec**,PetscInt,Vec**);
1522eac72dbSBarry Smith 
1537087cfbeSBarry Smith extern PetscErrorCode  KSPSetPC(KSP,PC);
1547087cfbeSBarry Smith extern PetscErrorCode  KSPGetPC(KSP,PC*);
155aabeff55SBarry Smith 
156228d79bcSJed Brown extern PetscErrorCode  KSPMonitor(KSP,PetscInt,PetscReal);
157c2efdce3SBarry 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);
17859709827SJed Brown extern PetscErrorCode  KSPChebychevSetEstimateEigenvalues(KSP,PetscReal,PetscReal,PetscReal,PetscReal);
1797087cfbeSBarry Smith extern PetscErrorCode  KSPComputeExtremeSingularValues(KSP,PetscReal*,PetscReal*);
1807087cfbeSBarry Smith extern PetscErrorCode  KSPComputeEigenvalues(KSP,PetscInt,PetscReal*,PetscReal*,PetscInt *);
1817087cfbeSBarry Smith extern PetscErrorCode  KSPComputeEigenvaluesExplicitly(KSP,PetscInt,PetscReal*,PetscReal*);
1824b0e389bSBarry Smith 
1837087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetRestart(KSP, PetscInt);
1847087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESGetRestart(KSP, PetscInt*);
1857087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetHapTol(KSP,PetscReal);
1869f236934SBarry Smith 
1877087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetPreAllocateVectors(KSP);
1887087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetOrthogonalization(KSP,PetscErrorCode (*)(KSP,PetscInt));
1897087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESGetOrthogonalization(KSP,PetscErrorCode (**)(KSP,PetscInt));
1907087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESModifiedGramSchmidtOrthogonalization(KSP,PetscInt);
1917087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESClassicalGramSchmidtOrthogonalization(KSP,PetscInt);
1921d73ed98SBarry Smith 
1937087cfbeSBarry Smith extern PetscErrorCode  KSPLGMRESSetAugDim(KSP,PetscInt);
1947087cfbeSBarry Smith extern PetscErrorCode  KSPLGMRESSetConstant(KSP);
1951d73ed98SBarry Smith 
1967087cfbeSBarry Smith extern PetscErrorCode  KSPGCRSetRestart(KSP,PetscInt);
1977087cfbeSBarry Smith extern PetscErrorCode  KSPGCRGetRestart(KSP,PetscInt*);
1987087cfbeSBarry Smith extern PetscErrorCode  KSPGCRSetModifyPC(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*),void*,PetscErrorCode(*)(void*));
19958ad63f4SBarry Smith 
200b49fd9e1SBarry Smith /*E
201b49fd9e1SBarry Smith     KSPGMRESCGSRefinementType - How the classical (unmodified) Gram-Schmidt is performed.
202b49fd9e1SBarry Smith 
203b49fd9e1SBarry Smith    Level: advanced
204b49fd9e1SBarry Smith 
205bef9c725SBarry Smith .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(),
206e928de20SBarry Smith           KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSPGMRESModifiedGramSchmidtOrthogonalization()
207b49fd9e1SBarry Smith 
208b49fd9e1SBarry Smith E*/
20978d1dd23SKris Buschelman typedef enum {KSP_GMRES_CGS_REFINE_NEVER, KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS} KSPGMRESCGSRefinementType;
2109dcbbd2bSBarry Smith extern const char *KSPGMRESCGSRefinementTypes[];
2111f7e983dSSatish Balay /*MC
2128c5b8ba0SBarry Smith     KSP_GMRES_CGS_REFINE_NEVER - Just do the classical (unmodified) Gram-Schmidt process
2138c5b8ba0SBarry Smith 
2148c5b8ba0SBarry Smith    Level: advanced
2158c5b8ba0SBarry Smith 
2168c5b8ba0SBarry Smith    Note: Possible unstable, but the fastest to compute
2178c5b8ba0SBarry Smith 
218bef9c725SBarry Smith .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(),
219e928de20SBarry Smith           KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS,
2208c5b8ba0SBarry Smith           KSPGMRESModifiedGramSchmidtOrthogonalization()
2218c5b8ba0SBarry Smith M*/
2228c5b8ba0SBarry Smith 
2231f7e983dSSatish Balay /*MC
2248c5b8ba0SBarry Smith     KSP_GMRES_CGS_REFINE_IFNEEDED - Do the classical (unmodified) Gram-Schmidt process and one step of
2258c5b8ba0SBarry Smith           iterative refinement if an estimate of the orthogonality of the resulting vectors indicates
2268c5b8ba0SBarry Smith           poor orthogonality.
2278c5b8ba0SBarry Smith 
2288c5b8ba0SBarry Smith    Level: advanced
2298c5b8ba0SBarry Smith 
2308c5b8ba0SBarry Smith    Note: This is slower than KSP_GMRES_CGS_REFINE_NEVER because it requires an extra norm computation to
2318c5b8ba0SBarry Smith      estimate the orthogonality but is more stable.
2328c5b8ba0SBarry Smith 
233bef9c725SBarry Smith .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(),
234e928de20SBarry Smith           KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSP_GMRES_CGS_REFINE_NEVER, KSP_GMRES_CGS_REFINE_ALWAYS,
2358c5b8ba0SBarry Smith           KSPGMRESModifiedGramSchmidtOrthogonalization()
2368c5b8ba0SBarry Smith M*/
2378c5b8ba0SBarry Smith 
2381f7e983dSSatish Balay /*MC
2398c5b8ba0SBarry Smith     KSP_GMRES_CGS_REFINE_NEVER - Do two steps of the classical (unmodified) Gram-Schmidt process.
2408c5b8ba0SBarry Smith 
2418c5b8ba0SBarry Smith    Level: advanced
2428c5b8ba0SBarry Smith 
2438c5b8ba0SBarry Smith    Note: This is roughly twice the cost of KSP_GMRES_CGS_REFINE_NEVER because it performs the process twice
2448c5b8ba0SBarry Smith      but it saves the extra norm calculation needed by KSP_GMRES_CGS_REFINE_IFNEEDED.
2458c5b8ba0SBarry Smith 
2468c5b8ba0SBarry Smith         You should only use this if you absolutely know that the iterative refinement is needed.
2478c5b8ba0SBarry Smith 
248bef9c725SBarry Smith .seealso: KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(),
249e928de20SBarry Smith           KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSP_GMRES_CGS_REFINE_IFNEEDED, KSP_GMRES_CGS_REFINE_ALWAYS,
2508c5b8ba0SBarry Smith           KSPGMRESModifiedGramSchmidtOrthogonalization()
2518c5b8ba0SBarry Smith M*/
2528c5b8ba0SBarry Smith 
2537087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESSetCGSRefinementType(KSP,KSPGMRESCGSRefinementType);
2547087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESGetCGSRefinementType(KSP,KSPGMRESCGSRefinementType*);
25508480c60SBarry Smith 
2567087cfbeSBarry Smith extern PetscErrorCode  KSPFGMRESModifyPCNoChange(KSP,PetscInt,PetscInt,PetscReal,void*);
2577087cfbeSBarry Smith extern PetscErrorCode  KSPFGMRESModifyPCKSP(KSP,PetscInt,PetscInt,PetscReal,void*);
2587087cfbeSBarry Smith extern PetscErrorCode  KSPFGMRESSetModifyPC(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscInt,PetscReal,void*),void*,PetscErrorCode(*)(void*));
259c38d4ed2SBarry Smith 
2607087cfbeSBarry Smith extern PetscErrorCode  KSPQCGSetTrustRegionRadius(KSP,PetscReal);
2617087cfbeSBarry Smith extern PetscErrorCode  KSPQCGGetQuadratic(KSP,PetscReal*);
2627087cfbeSBarry Smith extern PetscErrorCode  KSPQCGGetTrialStepNorm(KSP,PetscReal*);
263121fd945SKris Buschelman 
2647087cfbeSBarry Smith extern PetscErrorCode  KSPBCGSLSetXRes(KSP,PetscReal);
2657087cfbeSBarry Smith extern PetscErrorCode  KSPBCGSLSetPol(KSP,PetscBool );
2667087cfbeSBarry Smith extern PetscErrorCode  KSPBCGSLSetEll(KSP,PetscInt);
267d9492815SBarry Smith 
2687087cfbeSBarry Smith extern PetscErrorCode  KSPSetFromOptions(KSP);
2697087cfbeSBarry Smith extern PetscErrorCode  KSPAddOptionsChecker(PetscErrorCode (*)(KSP));
2702eac72dbSBarry Smith 
2717087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorSingularValue(KSP,PetscInt,PetscReal,void *);
2727087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorDefault(KSP,PetscInt,PetscReal,void *);
273e5297105SBarry Smith extern PetscErrorCode  KSPLSQRMonitorDefault(KSP,PetscInt,PetscReal,void *);
2747087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorRange(KSP,PetscInt,PetscReal,void *);
2757087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorTrueResidualNorm(KSP,PetscInt,PetscReal,void *);
2767087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorDefaultShort(KSP,PetscInt,PetscReal,void *);
2777087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorSolution(KSP,PetscInt,PetscReal,void *);
2787dc49fa8SJed Brown extern PetscErrorCode  KSPMonitorAMS(KSP,PetscInt,PetscReal,void*);
2797dc49fa8SJed Brown extern PetscErrorCode  KSPMonitorAMSCreate(KSP,const char*,void**);
2807dc49fa8SJed Brown extern PetscErrorCode  KSPMonitorAMSDestroy(void**);
2817087cfbeSBarry Smith extern PetscErrorCode  KSPGMRESMonitorKrylov(KSP,PetscInt,PetscReal,void *);
28284cb2905SBarry Smith 
2837087cfbeSBarry Smith extern PetscErrorCode  KSPUnwindPreconditioner(KSP,Vec,Vec);
2847087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultBuildSolution(KSP,Vec,Vec*);
2857087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultBuildResidual(KSP,Vec,Vec,Vec *);
2867087cfbeSBarry Smith extern PetscErrorCode  KSPInitialResidual(KSP,Vec,Vec,Vec,Vec,Vec);
287c01c455dSBarry Smith 
2887087cfbeSBarry Smith extern PetscErrorCode  KSPSetOperators(KSP,Mat,Mat,MatStructure);
2897087cfbeSBarry Smith extern PetscErrorCode  KSPGetOperators(KSP,Mat*,Mat*,MatStructure*);
2907087cfbeSBarry Smith extern PetscErrorCode  KSPGetOperatorsSet(KSP,PetscBool *,PetscBool *);
2917087cfbeSBarry Smith extern PetscErrorCode  KSPSetOptionsPrefix(KSP,const char[]);
2927087cfbeSBarry Smith extern PetscErrorCode  KSPAppendOptionsPrefix(KSP,const char[]);
2937087cfbeSBarry Smith extern PetscErrorCode  KSPGetOptionsPrefix(KSP,const char*[]);
2941eb62cbbSBarry Smith 
2957087cfbeSBarry Smith extern PetscErrorCode  KSPSetDiagonalScale(KSP,PetscBool );
2967087cfbeSBarry Smith extern PetscErrorCode  KSPGetDiagonalScale(KSP,PetscBool *);
2977087cfbeSBarry Smith extern PetscErrorCode  KSPSetDiagonalScaleFix(KSP,PetscBool );
2987087cfbeSBarry Smith extern PetscErrorCode  KSPGetDiagonalScaleFix(KSP,PetscBool *);
2991f7f0c4fSBarry Smith 
3007087cfbeSBarry Smith extern PetscErrorCode  KSPView(KSP,PetscViewer);
3011eb62cbbSBarry Smith 
3027087cfbeSBarry Smith extern PetscErrorCode  KSPLSQRSetStandardErrorVec(KSP,Vec);
3037087cfbeSBarry Smith extern PetscErrorCode  KSPLSQRGetStandardErrorVec(KSP,Vec*);
304db9b2ab1SHong Zhang 
30583ab6a24SBarry Smith extern PetscErrorCode  PCRedundantGetKSP(PC,KSP*);
3065e7ef714SBarry Smith extern PetscErrorCode  PCRedistributeGetKSP(PC,KSP*);
30783ab6a24SBarry Smith 
30828ce4d24SBarry Smith /*E
3098a4b9c5cSBarry Smith     KSPNormType - Norm that is passed in the Krylov convergence
3108a4b9c5cSBarry Smith        test routines.
3118a4b9c5cSBarry Smith 
3128a4b9c5cSBarry Smith    Level: advanced
3138a4b9c5cSBarry Smith 
314a3f661c8SBarry Smith    Each solver only supports a subset of these and some may support different ones
3151718446fSBarry Smith    depending on left or right preconditioning, see KSPSetPCSide()
316a3f661c8SBarry Smith 
3178a4b9c5cSBarry Smith    Notes: this must match finclude/petscksp.h
3188a4b9c5cSBarry Smith 
31994b7f48cSBarry Smith .seealso: KSPSolve(), KSPGetConvergedReason(), KSPSetNormType(),
3201718446fSBarry Smith           KSPSetConvergenceTest(), KSPSetPCSide()
3218a4b9c5cSBarry Smith E*/
3229e568555SJed Brown typedef enum {KSP_NORM_DEFAULT = -1,KSP_NORM_NONE = 0,KSP_NORM_PRECONDITIONED = 1,KSP_NORM_UNPRECONDITIONED = 2,KSP_NORM_NATURAL = 3} KSPNormType;
3239e568555SJed Brown #define KSP_NORM_MAX (KSP_NORM_NATURAL + 1)
3249e568555SJed Brown extern const char *const*const KSPNormTypes;
325a21b2a99SBarry Smith 
3261f7e983dSSatish Balay /*MC
3279793b452SBarry Smith     KSP_NORM_NONE - Do not compute a norm during the Krylov process. This will
3288c5b8ba0SBarry Smith           possibly save some computation but means the convergence test cannot
3298c5b8ba0SBarry Smith           be based on a norm of a residual etc.
3308c5b8ba0SBarry Smith 
3318c5b8ba0SBarry Smith    Level: advanced
3328c5b8ba0SBarry Smith 
333085a36d4SBarry Smith     Note: Some Krylov methods need to compute a residual norm and then this option is ignored
3348c5b8ba0SBarry Smith 
335ce9499c7SBarry Smith .seealso: KSPNormType, KSPSetNormType(), KSP_NORM_PRECONDITIONED, KSP_NORM_UNPRECONDITIONED, KSP_NORM_NATURAL
3368c5b8ba0SBarry Smith M*/
3378c5b8ba0SBarry Smith 
3381f7e983dSSatish Balay /*MC
339ce9499c7SBarry Smith     KSP_NORM_PRECONDITIONED - Compute the norm of the preconditioned residual and pass that to the
3408c5b8ba0SBarry Smith        convergence test routine.
3418c5b8ba0SBarry Smith 
3428c5b8ba0SBarry Smith    Level: advanced
3438c5b8ba0SBarry Smith 
3449793b452SBarry Smith .seealso: KSPNormType, KSPSetNormType(), KSP_NORM_NONE, KSP_NORM_UNPRECONDITIONED, KSP_NORM_NATURAL, KSPSetConvergenceTest()
3458c5b8ba0SBarry Smith M*/
3468c5b8ba0SBarry Smith 
3471f7e983dSSatish Balay /*MC
348ce9499c7SBarry Smith     KSP_NORM_UNPRECONDITIONED - Compute the norm of the true residual (b - A*x) and pass that to the
3498c5b8ba0SBarry Smith        convergence test routine.
3508c5b8ba0SBarry Smith 
3518c5b8ba0SBarry Smith    Level: advanced
3528c5b8ba0SBarry Smith 
3539793b452SBarry Smith .seealso: KSPNormType, KSPSetNormType(), KSP_NORM_NONE, KSP_NORM_PRECONDITIONED, KSP_NORM_NATURAL, KSPSetConvergenceTest()
3548c5b8ba0SBarry Smith M*/
3558c5b8ba0SBarry Smith 
3561f7e983dSSatish Balay /*MC
357ce9499c7SBarry Smith     KSP_NORM_NATURAL - Compute the 'natural norm' of residual sqrt((b - A*x)*B*(b - A*x)) and pass that to the
358a3f661c8SBarry Smith        convergence test routine. This is only supported by  KSPCG, KSPCR, KSPCGNE, KSPCGS
3598c5b8ba0SBarry Smith 
3608c5b8ba0SBarry Smith    Level: advanced
3618c5b8ba0SBarry Smith 
3629793b452SBarry Smith .seealso: KSPNormType, KSPSetNormType(), KSP_NORM_NONE, KSP_NORM_PRECONDITIONED, KSP_NORM_UNPRECONDITIONED, KSPSetConvergenceTest()
3638c5b8ba0SBarry Smith M*/
3648c5b8ba0SBarry Smith 
3657087cfbeSBarry Smith extern PetscErrorCode  KSPSetNormType(KSP,KSPNormType);
3667087cfbeSBarry Smith extern PetscErrorCode  KSPGetNormType(KSP,KSPNormType*);
3679e568555SJed Brown extern PetscErrorCode  KSPSetSupportedNorm(KSP ksp,KSPNormType,PCSide,PetscInt);
3687087cfbeSBarry Smith extern PetscErrorCode  KSPSetCheckNormIteration(KSP,PetscInt);
3697087cfbeSBarry Smith extern PetscErrorCode  KSPSetLagNorm(KSP,PetscBool );
3708a4b9c5cSBarry Smith 
3718a4b9c5cSBarry Smith /*E
37228ce4d24SBarry Smith     KSPConvergedReason - reason a Krylov method was said to
37328ce4d24SBarry Smith          have converged or diverged
37428ce4d24SBarry Smith 
37528ce4d24SBarry Smith    Level: beginner
37628ce4d24SBarry Smith 
3774d0a8057SBarry Smith    Notes: See KSPGetConvergedReason() for explanation of each value
37828ce4d24SBarry Smith 
3794d0a8057SBarry Smith    Developer notes: this must match finclude/petscksp.h
3804d0a8057SBarry Smith 
3814d0a8057SBarry Smith       The string versions of these are KSPConvergedReasons; if you change
3824d0a8057SBarry Smith       any of the values here also change them that array of names.
38386c02ca4SBarry Smith 
384c838673bSBarry Smith .seealso: KSPSolve(), KSPGetConvergedReason(), KSPSetTolerances()
38528ce4d24SBarry Smith E*/
386d15094e1SBarry Smith typedef enum {/* converged */
3879ecb1286SBarry Smith               KSP_CONVERGED_RTOL_NORMAL        =  1,
3889ecb1286SBarry Smith               KSP_CONVERGED_ATOL_NORMAL        =  9,
389d15094e1SBarry Smith               KSP_CONVERGED_RTOL               =  2,
390d15094e1SBarry Smith               KSP_CONVERGED_ATOL               =  3,
391b335793eSSatish Balay               KSP_CONVERGED_ITS                =  4,
3928031f4adStmunson               KSP_CONVERGED_CG_NEG_CURVE       =  5,
3938031f4adStmunson               KSP_CONVERGED_CG_CONSTRAINED     =  6,
394329f5518SBarry Smith               KSP_CONVERGED_STEP_LENGTH        =  7,
395af3d8002SBarry Smith               KSP_CONVERGED_HAPPY_BREAKDOWN    =  8,
396d15094e1SBarry Smith               /* diverged */
397b3cc6726SBarry Smith               KSP_DIVERGED_NULL                = -2,
398d15094e1SBarry Smith               KSP_DIVERGED_ITS                 = -3,
399d15094e1SBarry Smith               KSP_DIVERGED_DTOL                = -4,
400d15094e1SBarry Smith               KSP_DIVERGED_BREAKDOWN           = -5,
401b4ac9ba4SBarry Smith               KSP_DIVERGED_BREAKDOWN_BICG      = -6,
402b4ac9ba4SBarry Smith               KSP_DIVERGED_NONSYMMETRIC        = -7,
403b4ac9ba4SBarry Smith               KSP_DIVERGED_INDEFINITE_PC       = -8,
4046aee1118SBarry Smith               KSP_DIVERGED_NAN                 = -9,
4056aee1118SBarry Smith               KSP_DIVERGED_INDEFINITE_MAT      = -10,
406d15094e1SBarry Smith 
407d15094e1SBarry Smith               KSP_CONVERGED_ITERATING          =  0} KSPConvergedReason;
4087935a769SJed Brown extern const char *const*KSPConvergedReasons;
409d15094e1SBarry Smith 
410c838673bSBarry Smith /*MC
411c838673bSBarry Smith      KSP_CONVERGED_RTOL - norm(r) <= rtol*norm(b)
412c838673bSBarry Smith 
413c838673bSBarry Smith    Level: beginner
414c838673bSBarry Smith 
415c838673bSBarry Smith    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
416c838673bSBarry Smith        for left preconditioning it is the 2-norm of the preconditioned residual, and the
417c838673bSBarry Smith        2-norm of the residual for right preconditioning
418c838673bSBarry Smith 
419c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
420c838673bSBarry Smith 
421c838673bSBarry Smith M*/
422c838673bSBarry Smith 
423c838673bSBarry Smith /*MC
424c838673bSBarry Smith      KSP_CONVERGED_ATOL - norm(r) <= atol
425c838673bSBarry Smith 
426c838673bSBarry Smith    Level: beginner
427c838673bSBarry Smith 
428c838673bSBarry Smith    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
429c838673bSBarry Smith        for left preconditioning it is the 2-norm of the preconditioned residual, and the
430c838673bSBarry Smith        2-norm of the residual for right preconditioning
431c838673bSBarry Smith 
432c838673bSBarry Smith    Level: beginner
433c838673bSBarry Smith 
434c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
435c838673bSBarry Smith 
436c838673bSBarry Smith M*/
437c838673bSBarry Smith 
438c838673bSBarry Smith /*MC
439c838673bSBarry Smith      KSP_DIVERGED_DTOL - norm(r) >= dtol*norm(b)
440c838673bSBarry Smith 
441c838673bSBarry Smith    Level: beginner
442c838673bSBarry Smith 
443c838673bSBarry Smith    See KSPNormType and KSPSetNormType() for possible norms that may be used. By default
444c838673bSBarry Smith        for left preconditioning it is the 2-norm of the preconditioned residual, and the
445c838673bSBarry Smith        2-norm of the residual for right preconditioning
446c838673bSBarry Smith 
447c838673bSBarry Smith    Level: beginner
448c838673bSBarry Smith 
449c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
450c838673bSBarry Smith 
451c838673bSBarry Smith M*/
452c838673bSBarry Smith 
453c838673bSBarry Smith /*MC
454c838673bSBarry Smith      KSP_DIVERGED_ITS - Ran out of iterations before any convergence criteria was
455c838673bSBarry Smith       reached
456c838673bSBarry Smith 
457c838673bSBarry Smith    Level: beginner
458c838673bSBarry Smith 
459c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
460c838673bSBarry Smith 
461c838673bSBarry Smith M*/
462c838673bSBarry Smith 
463c838673bSBarry Smith /*MC
4648c9406f6SLisandro Dalcin      KSP_CONVERGED_ITS - Used by the KSPPREONLY solver after the single iteration of
4658c9406f6SLisandro Dalcin            the preconditioner is applied. Also used when the KSPSkipConverged() convergence
4664d0a8057SBarry Smith            test routine is set in KSP.
467c838673bSBarry Smith 
468c838673bSBarry Smith 
469c838673bSBarry Smith    Level: beginner
470c838673bSBarry Smith 
471c838673bSBarry Smith 
472c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
473c838673bSBarry Smith 
474c838673bSBarry Smith M*/
475c838673bSBarry Smith 
476c838673bSBarry Smith /*MC
477c838673bSBarry Smith      KSP_DIVERGED_BREAKDOWN - A breakdown in the Krylov method was detected so the
4783014e516SBarry Smith           method could not continue to enlarge the Krylov space. Could be due to a singlular matrix or
4793014e516SBarry Smith           preconditioner.
480c838673bSBarry Smith 
481c838673bSBarry Smith    Level: beginner
482c838673bSBarry Smith 
483c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
484c838673bSBarry Smith 
485c838673bSBarry Smith M*/
486c838673bSBarry Smith 
487c838673bSBarry Smith /*MC
488c838673bSBarry Smith      KSP_DIVERGED_BREAKDOWN_BICG - A breakdown in the KSPBICG method was detected so the
489c838673bSBarry Smith           method could not continue to enlarge the Krylov space.
490c838673bSBarry Smith 
491c838673bSBarry Smith 
492c838673bSBarry Smith    Level: beginner
493c838673bSBarry Smith 
494c838673bSBarry Smith 
495c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
496c838673bSBarry Smith 
497c838673bSBarry Smith M*/
498c838673bSBarry Smith 
499c838673bSBarry Smith /*MC
500c838673bSBarry Smith      KSP_DIVERGED_NONSYMMETRIC - It appears the operator or preconditioner is not
501c838673bSBarry Smith         symmetric and this Krylov method (KSPCG, KSPMINRES, KSPCR) requires symmetry
502c838673bSBarry Smith 
503c838673bSBarry Smith    Level: beginner
504c838673bSBarry Smith 
505c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
506c838673bSBarry Smith 
507c838673bSBarry Smith M*/
508c838673bSBarry Smith 
509c838673bSBarry Smith /*MC
510c838673bSBarry Smith      KSP_DIVERGED_INDEFINITE_PC - It appears the preconditioner is indefinite (has both
511c838673bSBarry Smith         positive and negative eigenvalues) and this Krylov method (KSPCG) requires it to
512c838673bSBarry Smith         be positive definite
513c838673bSBarry Smith 
514c838673bSBarry Smith    Level: beginner
515c838673bSBarry Smith 
5162401956bSBarry Smith      Notes: This can happen with the PCICC preconditioner, use -pc_factor_shift_positive_definite to force
517c838673bSBarry Smith   the PCICC preconditioner to generate a positive definite preconditioner
518c838673bSBarry Smith 
519c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
520c838673bSBarry Smith 
521c838673bSBarry Smith M*/
522c838673bSBarry Smith 
523c838673bSBarry Smith /*MC
524c838673bSBarry Smith      KSP_CONVERGED_ITERATING - This flag is returned if you call KSPGetConvergedReason()
525c838673bSBarry Smith         while the KSPSolve() is still running.
526c838673bSBarry Smith 
527c838673bSBarry Smith    Level: beginner
528c838673bSBarry Smith 
529c838673bSBarry Smith .seealso:  KSPSolve(), KSPGetConvergedReason(), KSPConvergedReason, KSPSetTolerances()
530c838673bSBarry Smith 
531c838673bSBarry Smith M*/
532c838673bSBarry Smith 
5337087cfbeSBarry Smith extern PetscErrorCode  KSPSetConvergenceTest(KSP,PetscErrorCode (*)(KSP,PetscInt,PetscReal,KSPConvergedReason*,void*),void *,PetscErrorCode (*)(void*));
5347087cfbeSBarry Smith extern PetscErrorCode  KSPGetConvergenceContext(KSP,void **);
5357087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConverged(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
5367087cfbeSBarry Smith extern PetscErrorCode  KSPConvergedLSQR(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
5377087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConvergedDestroy(void *);
5387087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConvergedCreate(void **);
5397087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConvergedSetUIRNorm(KSP);
5407087cfbeSBarry Smith extern PetscErrorCode  KSPDefaultConvergedSetUMIRNorm(KSP);
5417087cfbeSBarry Smith extern PetscErrorCode  KSPSkipConverged(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
5427087cfbeSBarry Smith extern PetscErrorCode  KSPGetConvergedReason(KSP,KSPConvergedReason *);
543abef13c0SSatish Balay 
5447087cfbeSBarry Smith extern PetscErrorCode  KSPComputeExplicitOperator(KSP,Mat *);
545d4fbbf0eSBarry Smith 
54628ce4d24SBarry Smith /*E
54728ce4d24SBarry Smith     KSPCGType - Determines what type of CG to use
54828ce4d24SBarry Smith 
54928ce4d24SBarry Smith    Level: beginner
55028ce4d24SBarry Smith 
55128ce4d24SBarry Smith .seealso: KSPCGSetType()
55228ce4d24SBarry Smith E*/
5539dcbbd2bSBarry Smith typedef enum {KSP_CG_SYMMETRIC=0,KSP_CG_HERMITIAN=1} KSPCGType;
5549dcbbd2bSBarry Smith extern const char *KSPCGTypes[];
55528ce4d24SBarry Smith 
5567087cfbeSBarry Smith extern PetscErrorCode  KSPCGSetType(KSP,KSPCGType);
5577087cfbeSBarry Smith extern PetscErrorCode  KSPCGUseSingleReduction(KSP,PetscBool );
5588031f4adStmunson 
5597087cfbeSBarry Smith extern PetscErrorCode  KSPNASHSetRadius(KSP,PetscReal);
5607087cfbeSBarry Smith extern PetscErrorCode  KSPNASHGetNormD(KSP,PetscReal *);
5617087cfbeSBarry Smith extern PetscErrorCode  KSPNASHGetObjFcn(KSP,PetscReal *);
562fcae7a14Stmunson 
5637087cfbeSBarry Smith extern PetscErrorCode  KSPSTCGSetRadius(KSP,PetscReal);
5647087cfbeSBarry Smith extern PetscErrorCode  KSPSTCGGetNormD(KSP,PetscReal *);
5657087cfbeSBarry Smith extern PetscErrorCode  KSPSTCGGetObjFcn(KSP,PetscReal *);
566e559a7feSLois Curfman McInnes 
5677087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRSetRadius(KSP,PetscReal);
5687087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRGetNormD(KSP,PetscReal *);
5697087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRGetObjFcn(KSP,PetscReal *);
5707087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRGetMinEig(KSP,PetscReal *);
5717087cfbeSBarry Smith extern PetscErrorCode  KSPGLTRGetLambda(KSP,PetscReal *);
5728031f4adStmunson 
5737087cfbeSBarry Smith extern PetscErrorCode  KSPPythonSetType(KSP,const char[]);
5741d6018f0SLisandro Dalcin 
5757087cfbeSBarry Smith extern PetscErrorCode  PCPreSolve(PC,KSP);
5767087cfbeSBarry Smith extern PetscErrorCode  PCPostSolve(PC,KSP);
5773369ce9aSBarry Smith 
5787087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGCreate(const char[],const char[],int,int,int,int,PetscDrawLG*);
5797087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLG(KSP,PetscInt,PetscReal,void*);
580fcfd50ebSBarry Smith extern PetscErrorCode  KSPMonitorLGDestroy(PetscDrawLG*);
5817087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGTrueResidualNormCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscDrawLG*);
5827087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGTrueResidualNorm(KSP,PetscInt,PetscReal,void*);
583fcfd50ebSBarry Smith extern PetscErrorCode  KSPMonitorLGTrueResidualNormDestroy(PetscDrawLG*);
5847087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGRangeCreate(const char[],const char[],int,int,int,int,PetscDrawLG*);
5857087cfbeSBarry Smith extern PetscErrorCode  KSPMonitorLGRange(KSP,PetscInt,PetscReal,void*);
586fcfd50ebSBarry Smith extern PetscErrorCode  KSPMonitorLGRangeDestroy(PetscDrawLG*);
5872f2e5d10SKris Buschelman 
5887087cfbeSBarry Smith extern PetscErrorCode  PCShellSetPreSolve(PC,PetscErrorCode (*)(PC,KSP,Vec,Vec));
5897087cfbeSBarry Smith extern PetscErrorCode  PCShellSetPostSolve(PC,PetscErrorCode (*)(PC,KSP,Vec,Vec));
59003919abeSBarry Smith 
591f8a50e2bSBarry Smith /* see src/ksp/ksp/interface/iguess.c */
592ace3abfcSBarry Smith typedef struct _p_KSPFischerGuess {PetscInt method,curl,maxl,refcnt;PetscBool  monitor;Mat mat; KSP ksp;}* KSPFischerGuess;
593f8a50e2bSBarry Smith 
5947087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessCreate(KSP,PetscInt,PetscInt,KSPFischerGuess*);
5957867f5c6SBarry Smith extern PetscErrorCode  KSPFischerGuessDestroy(KSPFischerGuess*);
5967087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessReset(KSPFischerGuess);
5977087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessUpdate(KSPFischerGuess,Vec);
5987087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessFormGuess(KSPFischerGuess,Vec,Vec);
5997087cfbeSBarry Smith extern PetscErrorCode  KSPFischerGuessSetFromOptions(KSPFischerGuess);
600f8a50e2bSBarry Smith 
6017087cfbeSBarry Smith extern PetscErrorCode  KSPSetUseFischerGuess(KSP,PetscInt,PetscInt);
6027087cfbeSBarry Smith extern PetscErrorCode  KSPSetFischerGuess(KSP,KSPFischerGuess);
6037087cfbeSBarry Smith extern PetscErrorCode  KSPGetFischerGuess(KSP,KSPFischerGuess*);
604f8a50e2bSBarry Smith 
6057087cfbeSBarry Smith extern PetscErrorCode  MatCreateSchurComplement(Mat,Mat,Mat,Mat,Mat,Mat*);
6067087cfbeSBarry Smith extern PetscErrorCode  MatSchurComplementGetKSP(Mat,KSP*);
6077087cfbeSBarry Smith extern PetscErrorCode  MatSchurComplementUpdate(Mat,Mat,Mat,Mat,Mat,Mat,MatStructure);
6087087cfbeSBarry Smith extern PetscErrorCode  MatSchurComplementGetSubmatrices(Mat,Mat*,Mat*,Mat*,Mat*,Mat*);
6097087cfbeSBarry Smith extern PetscErrorCode  MatGetSchurComplement(Mat,IS,IS,IS,IS,MatReuse,Mat *,MatReuse,Mat *);
6103f22127dSBarry Smith 
611fcfd50ebSBarry Smith extern PetscErrorCode  MatGetSchurComplement_Basic(Mat mat,IS isrow0,IS iscol0,IS isrow1,IS iscol1,MatReuse mreuse,Mat *newmat,MatReuse preuse,Mat *newpmat);
612fcfd50ebSBarry Smith 
6137087cfbeSBarry Smith extern PetscErrorCode  KSPSetDM(KSP,DM);
6147087cfbeSBarry Smith extern PetscErrorCode  KSPSetDMActive(KSP,PetscBool );
6157087cfbeSBarry Smith extern PetscErrorCode  KSPGetDM(KSP,DM*);
6167b0dc191SJed Brown extern PetscErrorCode  KSPSetApplicationContext(KSP,void*);
6177b0dc191SJed Brown extern PetscErrorCode  KSPGetApplicationContext(KSP,void*);
618fe86f630SJed Brown extern PetscErrorCode KSPSetComputeOperators(KSP,PetscErrorCode(*)(KSP,Mat,Mat,MatStructure*,void*),void*);
619fe86f630SJed Brown extern PetscErrorCode KSPSetComputeRHS(KSP,PetscErrorCode(*)(KSP,Vec,void*),void*);
620fe86f630SJed Brown extern PetscErrorCode DMKSPSetComputeOperators(DM,PetscErrorCode(*)(KSP,Mat,Mat,MatStructure*,void*),void*);
621fe86f630SJed Brown extern PetscErrorCode DMKSPGetComputeOperators(DM,PetscErrorCode(**)(KSP,Mat,Mat,MatStructure*,void*),void*);
622fe86f630SJed Brown extern PetscErrorCode DMKSPSetComputeRHS(DM,PetscErrorCode(*)(KSP,Vec,void*),void*);
623fe86f630SJed Brown extern PetscErrorCode DMKSPGetComputeRHS(DM,PetscErrorCode(**)(KSP,Vec,void*),void*);
6246c699258SBarry Smith 
625e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END
6262eac72dbSBarry Smith #endif
627