Actual source code: slepcqep.h
1: /*
2: User interface for SLEPc's quadratic eigenvalue solvers.
4: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5: SLEPc - Scalable Library for Eigenvalue Problem Computations
6: Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain
8: This file is part of SLEPc.
9:
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 slepcsys.h
27: #include slepceps.h
28: PETSC_EXTERN_CXX_BEGIN
30: extern PetscErrorCode QEPInitializePackage(const char[]);
32: /*S
33: QEP - Abstract SLEPc object that manages all the quadratic eigenvalue
34: problem solvers.
36: Level: beginner
38: .seealso: QEPCreate()
39: S*/
40: typedef struct _p_QEP* QEP;
42: /*E
43: QEPType - String with the name of a quadratic eigensolver
45: Level: beginner
47: .seealso: QEPSetType(), QEP
48: E*/
49: #define QEPType char*
50: #define QEPLINEAR "linear"
51: #define QEPQARNOLDI "qarnoldi"
53: /* Logging support */
54: extern PetscClassId QEP_CLASSID;
56: /*E
57: QEPProblemType - determines the type of the quadratic eigenproblem
59: Level: intermediate
61: .seealso: QEPSetProblemType(), QEPGetProblemType()
62: E*/
63: typedef enum { QEP_GENERAL=1,
64: QEP_HERMITIAN, /* M, C, K Hermitian */
65: QEP_GYROSCOPIC /* M, K Hermitian, M>0, C skew-Hermitian */
66: } QEPProblemType;
68: /*E
69: QEPWhich - determines which part of the spectrum is requested
71: Level: intermediate
73: .seealso: QEPSetWhichEigenpairs(), QEPGetWhichEigenpairs()
74: E*/
75: typedef enum { QEP_LARGEST_MAGNITUDE=1,
76: QEP_SMALLEST_MAGNITUDE,
77: QEP_LARGEST_REAL,
78: QEP_SMALLEST_REAL,
79: QEP_LARGEST_IMAGINARY,
80: QEP_SMALLEST_IMAGINARY } QEPWhich;
82: extern PetscErrorCode QEPCreate(MPI_Comm,QEP*);
83: extern PetscErrorCode QEPDestroy(QEP*);
84: extern PetscErrorCode QEPReset(QEP);
85: extern PetscErrorCode QEPSetType(QEP,const QEPType);
86: extern PetscErrorCode QEPGetType(QEP,const QEPType*);
87: extern PetscErrorCode QEPSetProblemType(QEP,QEPProblemType);
88: extern PetscErrorCode QEPGetProblemType(QEP,QEPProblemType*);
89: extern PetscErrorCode QEPSetOperators(QEP,Mat,Mat,Mat);
90: extern PetscErrorCode QEPGetOperators(QEP,Mat*,Mat*,Mat*);
91: extern PetscErrorCode QEPSetFromOptions(QEP);
92: extern PetscErrorCode QEPSetUp(QEP);
93: extern PetscErrorCode QEPSolve(QEP);
94: extern PetscErrorCode QEPView(QEP,PetscViewer);
95: extern PetscErrorCode QEPPrintSolution(QEP,PetscViewer);
97: extern PetscErrorCode QEPSetIP(QEP,IP);
98: extern PetscErrorCode QEPGetIP(QEP,IP*);
99: extern PetscErrorCode QEPSetTolerances(QEP,PetscReal,PetscInt);
100: extern PetscErrorCode QEPGetTolerances(QEP,PetscReal*,PetscInt*);
101: extern PetscErrorCode QEPSetConvergenceTest(QEP,PetscErrorCode (*)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void*);
102: extern PetscErrorCode QEPDefaultConverged(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
103: extern PetscErrorCode QEPAbsoluteConverged(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
104: extern PetscErrorCode QEPSetDimensions(QEP,PetscInt,PetscInt,PetscInt);
105: extern PetscErrorCode QEPGetDimensions(QEP,PetscInt*,PetscInt*,PetscInt*);
106: extern PetscErrorCode QEPSetScaleFactor(QEP,PetscReal);
107: extern PetscErrorCode QEPGetScaleFactor(QEP,PetscReal*);
109: extern PetscErrorCode QEPGetConverged(QEP,PetscInt*);
110: extern PetscErrorCode QEPGetEigenpair(QEP,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec);
111: extern PetscErrorCode QEPComputeRelativeError(QEP,PetscInt,PetscReal*);
112: extern PetscErrorCode QEPComputeResidualNorm(QEP,PetscInt,PetscReal*);
113: extern PetscErrorCode QEPGetErrorEstimate(QEP,PetscInt,PetscReal*);
115: extern PetscErrorCode QEPMonitorSet(QEP,PetscErrorCode (*)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
116: extern PetscErrorCode QEPMonitorCancel(QEP);
117: extern PetscErrorCode QEPGetMonitorContext(QEP,void **);
118: extern PetscErrorCode QEPGetIterationNumber(QEP,PetscInt*);
119: extern PetscErrorCode QEPGetOperationCounters(QEP,PetscInt*,PetscInt*,PetscInt*);
121: extern PetscErrorCode QEPSetInitialSpace(QEP,PetscInt,Vec*);
122: extern PetscErrorCode QEPSetInitialSpaceLeft(QEP,PetscInt,Vec*);
123: extern PetscErrorCode QEPSetWhichEigenpairs(QEP,QEPWhich);
124: extern PetscErrorCode QEPGetWhichEigenpairs(QEP,QEPWhich*);
125: extern PetscErrorCode QEPSetLeftVectorsWanted(QEP,PetscBool);
126: extern PetscErrorCode QEPGetLeftVectorsWanted(QEP,PetscBool*);
127: extern PetscErrorCode QEPSetEigenvalueComparison(QEP,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*);
129: extern PetscErrorCode QEPMonitorAll(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
130: extern PetscErrorCode QEPMonitorFirst(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
131: extern PetscErrorCode QEPMonitorConverged(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
132: extern PetscErrorCode QEPMonitorLG(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
133: extern PetscErrorCode QEPMonitorLGAll(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
135: extern PetscErrorCode QEPSetTrackAll(QEP,PetscBool);
136: extern PetscErrorCode QEPGetTrackAll(QEP,PetscBool*);
138: extern PetscErrorCode QEPSetOptionsPrefix(QEP,const char*);
139: extern PetscErrorCode QEPAppendOptionsPrefix(QEP,const char*);
140: extern PetscErrorCode QEPGetOptionsPrefix(QEP,const char*[]);
142: /*E
143: QEPConvergedReason - reason an eigensolver was said to
144: have converged or diverged
146: Level: beginner
148: .seealso: QEPSolve(), QEPGetConvergedReason(), QEPSetTolerances()
149: E*/
150: typedef enum {/* converged */
151: QEP_CONVERGED_TOL = 2,
152: /* diverged */
153: QEP_DIVERGED_ITS = -3,
154: QEP_DIVERGED_BREAKDOWN = -4,
155: QEP_CONVERGED_ITERATING = 0} QEPConvergedReason;
157: extern PetscErrorCode QEPGetConvergedReason(QEP,QEPConvergedReason *);
159: extern PetscErrorCode QEPSortEigenvalues(QEP,PetscInt,PetscScalar*,PetscScalar*,PetscInt*);
160: extern PetscErrorCode QEPSortEigenvaluesReal(QEP,PetscInt,PetscReal*,PetscInt*);
161: extern PetscErrorCode QEPCompareEigenvalues(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*);
162: extern PetscErrorCode QEPSortDenseSchur(QEP,PetscInt,PetscInt,PetscScalar*,PetscInt,PetscScalar*,PetscScalar*,PetscScalar*);
164: extern PetscFList QEPList;
165: extern PetscBool QEPRegisterAllCalled;
166: extern PetscErrorCode QEPRegisterAll(const char[]);
167: extern PetscErrorCode QEPRegisterDestroy(void);
168: extern PetscErrorCode QEPRegister(const char[],const char[],const char[],PetscErrorCode(*)(QEP));
170: /*MC
171: QEPRegisterDynamic - Adds a method to the quadratic eigenproblem solver package.
173: Synopsis:
174: PetscErrorCode QEPRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(QEP))
176: Not Collective
178: Input Parameters:
179: + name_solver - name of a new user-defined solver
180: . path - path (either absolute or relative) the library containing this solver
181: . name_create - name of routine to create the solver context
182: - routine_create - routine to create the solver context
184: Notes:
185: QEPRegisterDynamic() may be called multiple times to add several user-defined solvers.
187: If dynamic libraries are used, then the fourth input argument (routine_create)
188: is ignored.
190: Sample usage:
191: .vb
192: QEPRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a,
193: "MySolverCreate",MySolverCreate);
194: .ve
196: Then, your solver can be chosen with the procedural interface via
197: $ QEPSetType(qep,"my_solver")
198: or at runtime via the option
199: $ -qep_type my_solver
201: Level: advanced
203: .seealso: QEPRegisterDestroy(), QEPRegisterAll()
204: M*/
205: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
206: #define QEPRegisterDynamic(a,b,c,d) QEPRegister(a,b,c,0)
207: #else
208: #define QEPRegisterDynamic(a,b,c,d) QEPRegister(a,b,c,d)
209: #endif
211: /* --------- options specific to particular eigensolvers -------- */
213: extern PetscErrorCode QEPLinearSetCompanionForm(QEP,PetscInt);
214: extern PetscErrorCode QEPLinearGetCompanionForm(QEP,PetscInt*);
215: extern PetscErrorCode QEPLinearSetExplicitMatrix(QEP,PetscBool);
216: extern PetscErrorCode QEPLinearGetExplicitMatrix(QEP,PetscBool*);
217: extern PetscErrorCode QEPLinearSetEPS(QEP,EPS);
218: extern PetscErrorCode QEPLinearGetEPS(QEP,EPS*);
220: PETSC_EXTERN_CXX_END
221: #endif