Subversion Repositories slepc-dev

Rev

Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1887 jroman 1
/*
2
   User interface for SLEPc's quadratic eigenvalue solvers.
3
 
4
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5
   SLEPc - Scalable Library for Eigenvalue Problem Computations
2575 eromero 6
   Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain
1887 jroman 7
 
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.
13
 
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.
18
 
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
*/
23
 
24
#if !defined(__SLEPCQEP_H)
25
#define __SLEPCQEP_H
26
#include "slepcsys.h"
1891 jroman 27
#include "slepceps.h"
1887 jroman 28
PETSC_EXTERN_CXX_BEGIN
29
 
2375 jroman 30
extern PetscErrorCode QEPInitializePackage(const char[]);
1887 jroman 31
 
32
/*S
33
     QEP - Abstract SLEPc object that manages all the quadratic eigenvalue
34
     problem solvers.
35
 
36
   Level: beginner
37
 
38
.seealso:  QEPCreate()
39
S*/
40
typedef struct _p_QEP* QEP;
41
 
42
/*E
43
    QEPType - String with the name of a quadratic eigensolver
44
 
45
   Level: beginner
46
 
47
.seealso: QEPSetType(), QEP
48
E*/
49
#define QEPType      char*
50
#define QEPLINEAR    "linear"
2044 antodo 51
#define QEPQARNOLDI  "qarnoldi"
1887 jroman 52
 
2375 jroman 53
/* Logging support */
54
extern PetscClassId QEP_CLASSID;
55
 
1887 jroman 56
/*E
1907 jroman 57
    QEPProblemType - determines the type of the quadratic eigenproblem
58
 
59
    Level: intermediate
60
 
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;
67
 
68
/*E
1887 jroman 69
    QEPWhich - determines which part of the spectrum is requested
70
 
71
    Level: intermediate
72
 
73
.seealso: QEPSetWhichEigenpairs(), QEPGetWhichEigenpairs()
74
E*/
1942 jroman 75
typedef enum { QEP_LARGEST_MAGNITUDE=1,
1940 jroman 76
               QEP_SMALLEST_MAGNITUDE,
77
               QEP_LARGEST_REAL,
78
               QEP_SMALLEST_REAL,
79
               QEP_LARGEST_IMAGINARY,
80
               QEP_SMALLEST_IMAGINARY } QEPWhich;
1887 jroman 81
 
2240 jroman 82
extern PetscErrorCode QEPCreate(MPI_Comm,QEP*);
2312 jroman 83
extern PetscErrorCode QEPDestroy(QEP*);
2361 jroman 84
extern PetscErrorCode QEPReset(QEP);
2240 jroman 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);
2513 jroman 95
extern PetscErrorCode QEPPrintSolution(QEP,PetscViewer);
1887 jroman 96
 
2240 jroman 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*);
1887 jroman 108
 
2240 jroman 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*);
1887 jroman 114
 
2351 jroman 115
extern PetscErrorCode QEPMonitorSet(QEP,PetscErrorCode (*)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
2240 jroman 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*);
1887 jroman 120
 
2240 jroman 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*);
1887 jroman 128
 
2240 jroman 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*);
1887 jroman 134
 
2240 jroman 135
extern PetscErrorCode QEPSetTrackAll(QEP,PetscBool);
136
extern PetscErrorCode QEPGetTrackAll(QEP,PetscBool*);
2054 eromero 137
 
2240 jroman 138
extern PetscErrorCode QEPSetOptionsPrefix(QEP,const char*);
139
extern PetscErrorCode QEPAppendOptionsPrefix(QEP,const char*);
140
extern PetscErrorCode QEPGetOptionsPrefix(QEP,const char*[]);
1887 jroman 141
 
142
/*E
143
    QEPConvergedReason - reason an eigensolver was said to
144
         have converged or diverged
145
 
146
    Level: beginner
147
 
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;
156
 
2240 jroman 157
extern PetscErrorCode QEPGetConvergedReason(QEP,QEPConvergedReason *);
1887 jroman 158
 
2240 jroman 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*);
1887 jroman 163
 
2375 jroman 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));
169
 
170
/*MC
171
   QEPRegisterDynamic - Adds a method to the quadratic eigenproblem solver package.
172
 
173
   Synopsis:
174
   PetscErrorCode QEPRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(QEP))
175
 
176
   Not Collective
177
 
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
183
 
184
   Notes:
185
   QEPRegisterDynamic() may be called multiple times to add several user-defined solvers.
186
 
187
   If dynamic libraries are used, then the fourth input argument (routine_create)
188
   is ignored.
189
 
190
   Sample usage:
191
.vb
192
   QEPRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a,
193
               "MySolverCreate",MySolverCreate);
194
.ve
195
 
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
200
 
201
   Level: advanced
202
 
203
.seealso: QEPRegisterDestroy(), QEPRegisterAll()
204
M*/
1887 jroman 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
210
 
211
/* --------- options specific to particular eigensolvers -------- */
212
 
2240 jroman 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*);
1887 jroman 219
 
220
PETSC_EXTERN_CXX_END
221
#endif
222