Actual source code: slepcnep.h
1: /*
2: User interface for SLEPc's nonlinear eigenvalue solvers.
4: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5: SLEPc - Scalable Library for Eigenvalue Problem Computations
6: Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
8: This file is part of SLEPc.
10: SLEPc is free software: you can redistribute it and/or modify it under the
11: terms of version 3 of the GNU Lesser General Public License as published by
12: the Free Software Foundation.
14: SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY
15: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16: FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
17: more details.
19: You should have received a copy of the GNU Lesser General Public License
20: along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
21: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22: */
26: #include <slepceps.h>
27: #include <slepcfn.h>
29: PETSC_EXTERN PetscErrorCode NEPInitializePackage(void);
31: /*S
32: NEP - Abstract SLEPc object that manages all solvers for
33: nonlinear eigenvalue problems.
35: Level: beginner
37: .seealso: NEPCreate()
38: S*/
39: typedef struct _p_NEP* NEP;
41: /*J
42: NEPType - String with the name of a nonlinear eigensolver
44: Level: beginner
46: .seealso: NEPSetType(), NEP
47: J*/
48: typedef const char* NEPType;
49: #define NEPRII "rii"
50: #define NEPSLP "slp"
51: #define NEPNARNOLDI "narnoldi"
53: /* Logging support */
54: PETSC_EXTERN PetscClassId NEP_CLASSID;
56: /*E
57: NEPWhich - Determines which part of the spectrum is requested
59: Level: intermediate
61: .seealso: NEPSetWhichEigenpairs(), NEPGetWhichEigenpairs()
62: E*/
63: typedef enum { NEP_LARGEST_MAGNITUDE=1,
64: NEP_SMALLEST_MAGNITUDE,
65: NEP_LARGEST_REAL,
66: NEP_SMALLEST_REAL,
67: NEP_LARGEST_IMAGINARY,
68: NEP_SMALLEST_IMAGINARY,
69: NEP_TARGET_MAGNITUDE,
70: NEP_TARGET_REAL,
71: NEP_TARGET_IMAGINARY} NEPWhich;
73: /*E
74: NEPConvergedReason - Reason a nonlinear eigensolver was said to
75: have converged or diverged
77: Level: beginner
79: .seealso: NEPSolve(), NEPGetConvergedReason(), NEPSetTolerances()
80: E*/
81: typedef enum {/* converged */
82: NEP_CONVERGED_FNORM_ABS = 2,
83: NEP_CONVERGED_FNORM_RELATIVE = 3,
84: NEP_CONVERGED_SNORM_RELATIVE = 4,
85: /* diverged */
86: NEP_DIVERGED_LINEAR_SOLVE = -1,
87: NEP_DIVERGED_FUNCTION_COUNT = -2,
88: NEP_DIVERGED_MAX_IT = -3,
89: NEP_DIVERGED_BREAKDOWN = -4,
90: NEP_DIVERGED_FNORM_NAN = -5,
91: NEP_CONVERGED_ITERATING = 0} NEPConvergedReason;
93: PETSC_EXTERN PetscErrorCode NEPCreate(MPI_Comm,NEP*);
94: PETSC_EXTERN PetscErrorCode NEPDestroy(NEP*);
95: PETSC_EXTERN PetscErrorCode NEPReset(NEP);
96: PETSC_EXTERN PetscErrorCode NEPSetType(NEP,NEPType);
97: PETSC_EXTERN PetscErrorCode NEPGetType(NEP,NEPType*);
98: PETSC_EXTERN PetscErrorCode NEPSetTarget(NEP,PetscScalar);
99: PETSC_EXTERN PetscErrorCode NEPGetTarget(NEP,PetscScalar*);
100: PETSC_EXTERN PetscErrorCode NEPSetKSP(NEP,KSP);
101: PETSC_EXTERN PetscErrorCode NEPGetKSP(NEP,KSP*);
102: PETSC_EXTERN PetscErrorCode NEPSetFromOptions(NEP);
103: PETSC_EXTERN PetscErrorCode NEPSetUp(NEP);
104: PETSC_EXTERN PetscErrorCode NEPSolve(NEP);
105: PETSC_EXTERN PetscErrorCode NEPView(NEP,PetscViewer);
107: PETSC_EXTERN PetscErrorCode NEPSetFunction(NEP,Mat,Mat,PetscErrorCode (*)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void*);
108: PETSC_EXTERN PetscErrorCode NEPGetFunction(NEP,Mat*,Mat*,PetscErrorCode (**)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void**);
109: PETSC_EXTERN PetscErrorCode NEPSetJacobian(NEP,Mat,PetscErrorCode (*)(NEP,PetscScalar,Mat*,MatStructure*,void*),void*);
110: PETSC_EXTERN PetscErrorCode NEPGetJacobian(NEP,Mat*,PetscErrorCode (**)(NEP,PetscScalar,Mat*,MatStructure*,void*),void**);
111: PETSC_EXTERN PetscErrorCode NEPSetSplitOperator(NEP,PetscInt,Mat*,FN*,MatStructure);
112: PETSC_EXTERN PetscErrorCode NEPGetSplitOperatorTerm(NEP,PetscInt,Mat*,FN*);
113: PETSC_EXTERN PetscErrorCode NEPGetSplitOperatorInfo(NEP,PetscInt*,MatStructure*);
115: PETSC_EXTERN PetscErrorCode NEPSetIP(NEP,IP);
116: PETSC_EXTERN PetscErrorCode NEPGetIP(NEP,IP*);
117: PETSC_EXTERN PetscErrorCode NEPSetDS(NEP,DS);
118: PETSC_EXTERN PetscErrorCode NEPGetDS(NEP,DS*);
119: PETSC_EXTERN PetscErrorCode NEPSetTolerances(NEP,PetscReal,PetscReal,PetscReal,PetscInt,PetscInt);
120: PETSC_EXTERN PetscErrorCode NEPGetTolerances(NEP,PetscReal*,PetscReal*,PetscReal*,PetscInt*,PetscInt*);
121: PETSC_EXTERN PetscErrorCode NEPSetConvergenceTest(NEP,PetscErrorCode (*)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*),void*,PetscErrorCode (*)(void*));
122: PETSC_EXTERN PetscErrorCode NEPConvergedDefault(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*);
123: PETSC_EXTERN PetscErrorCode NEPSetDimensions(NEP,PetscInt,PetscInt,PetscInt);
124: PETSC_EXTERN PetscErrorCode NEPGetDimensions(NEP,PetscInt*,PetscInt*,PetscInt*);
125: PETSC_EXTERN PetscErrorCode NEPSetLagPreconditioner(NEP,PetscInt);
126: PETSC_EXTERN PetscErrorCode NEPGetLagPreconditioner(NEP,PetscInt*);
127: PETSC_EXTERN PetscErrorCode NEPSetConstCorrectionTol(NEP,PetscBool);
128: PETSC_EXTERN PetscErrorCode NEPGetConstCorrectionTol(NEP,PetscBool*);
130: PETSC_EXTERN PetscErrorCode NEPGetConverged(NEP,PetscInt*);
131: PETSC_EXTERN PetscErrorCode NEPGetEigenpair(NEP,PetscInt,PetscScalar*,Vec);
133: PETSC_EXTERN PetscErrorCode NEPComputeRelativeError(NEP,PetscInt,PetscReal*);
134: PETSC_EXTERN PetscErrorCode NEPComputeResidualNorm(NEP,PetscInt,PetscReal*);
135: PETSC_EXTERN PetscErrorCode NEPGetErrorEstimate(NEP,PetscInt,PetscReal*);
137: PETSC_EXTERN PetscErrorCode NEPComputeFunction(NEP,PetscScalar,Mat*,Mat*,MatStructure*);
138: PETSC_EXTERN PetscErrorCode NEPComputeJacobian(NEP,PetscScalar,Mat*,MatStructure*);
139: PETSC_EXTERN PetscErrorCode NEPApplyFunction(NEP,PetscScalar,Vec,Vec,Vec,Mat*,Mat*,MatStructure*);
140: PETSC_EXTERN PetscErrorCode NEPApplyJacobian(NEP,PetscScalar,Vec,Vec,Vec,Mat*,MatStructure*);
141: PETSC_EXTERN PetscErrorCode NEPProjectOperator(NEP,PetscInt,PetscInt,Vec);
143: PETSC_EXTERN PetscErrorCode NEPMonitor(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt);
144: PETSC_EXTERN PetscErrorCode NEPMonitorSet(NEP,PetscErrorCode (*)(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
145: PETSC_EXTERN PetscErrorCode NEPMonitorCancel(NEP);
146: PETSC_EXTERN PetscErrorCode NEPGetMonitorContext(NEP,void **);
147: PETSC_EXTERN PetscErrorCode NEPGetIterationNumber(NEP,PetscInt*);
148: PETSC_EXTERN PetscErrorCode NEPGetOperationCounters(NEP,PetscInt*,PetscInt*,PetscInt*);
150: PETSC_EXTERN PetscErrorCode NEPSetInitialSpace(NEP,PetscInt,Vec*);
151: PETSC_EXTERN PetscErrorCode NEPSetWhichEigenpairs(NEP,NEPWhich);
152: PETSC_EXTERN PetscErrorCode NEPGetWhichEigenpairs(NEP,NEPWhich*);
153: PETSC_EXTERN PetscErrorCode NEPSetEigenvalueComparison(NEP,PetscErrorCode (*func)(NEP,PetscScalar,PetscScalar,PetscInt*,void*),void*);
155: PETSC_EXTERN PetscErrorCode NEPMonitorAll(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
156: PETSC_EXTERN PetscErrorCode NEPMonitorFirst(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
157: PETSC_EXTERN PetscErrorCode NEPMonitorConverged(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
158: PETSC_EXTERN PetscErrorCode NEPMonitorLG(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
159: PETSC_EXTERN PetscErrorCode NEPMonitorLGAll(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
161: PETSC_EXTERN PetscErrorCode NEPSetTrackAll(NEP,PetscBool);
162: PETSC_EXTERN PetscErrorCode NEPGetTrackAll(NEP,PetscBool*);
164: PETSC_EXTERN PetscErrorCode NEPSetOptionsPrefix(NEP,const char*);
165: PETSC_EXTERN PetscErrorCode NEPAppendOptionsPrefix(NEP,const char*);
166: PETSC_EXTERN PetscErrorCode NEPGetOptionsPrefix(NEP,const char*[]);
168: PETSC_EXTERN PetscErrorCode NEPGetConvergedReason(NEP,NEPConvergedReason *);
170: PETSC_EXTERN PetscErrorCode NEPSortEigenvalues(NEP,PetscInt,PetscScalar*,PetscInt*);
171: PETSC_EXTERN PetscErrorCode NEPCompareEigenvalues(NEP,PetscScalar,PetscScalar,PetscInt*);
173: PETSC_EXTERN PetscFunctionList NEPList;
174: PETSC_EXTERN PetscBool NEPRegisterAllCalled;
175: PETSC_EXTERN PetscErrorCode NEPRegisterAll(void);
176: PETSC_EXTERN PetscErrorCode NEPRegister(const char[],PetscErrorCode(*)(NEP));
178: PETSC_EXTERN PetscErrorCode NEPSetWorkVecs(NEP,PetscInt);
180: /* --------- options specific to particular eigensolvers -------- */
182: PETSC_EXTERN PetscErrorCode NEPSLPSetEPS(NEP,EPS);
183: PETSC_EXTERN PetscErrorCode NEPSLPGetEPS(NEP,EPS*);
185: #endif