| 1976 |
eromero |
1 |
/*
|
|
|
2 |
SLEPc eigensolver: "davidson"
|
|
|
3 |
|
|
|
4 |
Method: General Davidson Method
|
|
|
5 |
|
|
|
6 |
References:
|
|
|
7 |
- Ernest R. Davidson. Super-matrix methods. Computer Physics Communications,
|
|
|
8 |
53:49–60, May 1989.
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
#include "private/epsimpl.h" /*I "slepceps.h" I*/
|
|
|
12 |
#include "private/stimpl.h"
|
| 1985 |
eromero |
13 |
#include "../src/eps/impls/davidson/common/davidson.h"
|
| 1976 |
eromero |
14 |
#include "slepcblaslapack.h"
|
|
|
15 |
|
| 2003 |
eromero |
16 |
PetscErrorCode EPSSetUp_JD(EPS eps);
|
| 1994 |
eromero |
17 |
PetscErrorCode EPSDestroy_JD(EPS eps);
|
| 1976 |
eromero |
18 |
|
|
|
19 |
EXTERN_C_BEGIN
|
|
|
20 |
#undef __FUNCT__
|
| 1994 |
eromero |
21 |
#define __FUNCT__ "EPSSetFromOptions_JD"
|
|
|
22 |
PetscErrorCode EPSSetFromOptions_JD(EPS eps)
|
| 1976 |
eromero |
23 |
{
|
|
|
24 |
PetscErrorCode ierr;
|
|
|
25 |
PetscTruth flg,op;
|
|
|
26 |
PetscInt opi,opi0;
|
| 1994 |
eromero |
27 |
PetscReal opf;
|
| 1976 |
eromero |
28 |
|
|
|
29 |
PetscFunctionBegin;
|
|
|
30 |
|
| 1994 |
eromero |
31 |
ierr = PetscOptionsHead("JD options");CHKERRQ(ierr);
|
| 1976 |
eromero |
32 |
|
| 1994 |
eromero |
33 |
ierr = EPSJDGetKrylovStart(eps, &op); CHKERRQ(ierr);
|
|
|
34 |
ierr = PetscOptionsTruth("-eps_jd_krylov_start","Start the searching subspace with a krylov basis","EPSJDSetKrylovStart",op,&op,&flg); CHKERRQ(ierr);
|
|
|
35 |
if(flg) { ierr = EPSJDSetKrylovStart(eps, op); CHKERRQ(ierr); }
|
| 1976 |
eromero |
36 |
|
| 1994 |
eromero |
37 |
ierr = EPSJDGetBlockSize(eps, &opi); CHKERRQ(ierr);
|
|
|
38 |
ierr = PetscOptionsInt("-eps_jd_blocksize","Number vectors add to the searching subspace (if 0, nev employed)","EPSJDSetBlockSize",opi,&opi,&flg); CHKERRQ(ierr);
|
|
|
39 |
if(flg) { ierr = EPSJDSetBlockSize(eps, opi); CHKERRQ(ierr); }
|
| 1976 |
eromero |
40 |
|
| 1994 |
eromero |
41 |
ierr = EPSJDGetRestart(eps, &opi, &opi0); CHKERRQ(ierr);
|
|
|
42 |
ierr = PetscOptionsInt("-eps_jd_minv","Set the size of the searching subspace after restarting (if 0, eps_jd_bs is employed)","EPSJDSetRestart",opi,&opi,&flg); CHKERRQ(ierr);
|
|
|
43 |
if(flg) { ierr = EPSJDSetRestart(eps, opi, opi0); CHKERRQ(ierr); }
|
| 1976 |
eromero |
44 |
|
| 1994 |
eromero |
45 |
ierr = PetscOptionsInt("-eps_jd_plusk","Set the number of saved eigenvectors from the previous iteration when restarting","EPSJDSetRestart",opi0,&opi0,&flg); CHKERRQ(ierr);
|
|
|
46 |
if(flg) { ierr = EPSJDSetRestart(eps, opi, opi0); CHKERRQ(ierr); }
|
| 1976 |
eromero |
47 |
|
| 1994 |
eromero |
48 |
ierr = EPSJDGetInitialSize(eps, &opi); CHKERRQ(ierr);
|
|
|
49 |
ierr = PetscOptionsInt("-eps_jd_initial_size","Set the initial size of the searching subspace","EPSJDSetInitialSize",opi,&opi,&flg); CHKERRQ(ierr);
|
|
|
50 |
if(flg) { ierr = EPSJDSetInitialSize(eps, opi); CHKERRQ(ierr); }
|
| 1980 |
eromero |
51 |
|
| 1994 |
eromero |
52 |
ierr = EPSJDGetFix(eps, &opf); CHKERRQ(ierr);
|
|
|
53 |
ierr = PetscOptionsReal("-eps_jd_fix","Set the tolerance for changing the target in the correction equation","EPSJDSetFix",opf,&opf,&flg); CHKERRQ(ierr);
|
|
|
54 |
if(flg) { ierr = EPSJDSetFix(eps, opf); CHKERRQ(ierr); }
|
|
|
55 |
|
| 1976 |
eromero |
56 |
ierr = PetscOptionsTail();CHKERRQ(ierr);
|
|
|
57 |
|
|
|
58 |
PetscFunctionReturn(0);
|
|
|
59 |
}
|
|
|
60 |
EXTERN_C_END
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
EXTERN_C_BEGIN
|
|
|
64 |
#undef __FUNCT__
|
| 2003 |
eromero |
65 |
#define __FUNCT__ "EPSSetUp_JD"
|
|
|
66 |
PetscErrorCode EPSSetUp_JD(EPS eps)
|
|
|
67 |
{
|
|
|
68 |
PetscErrorCode ierr;
|
|
|
69 |
PetscTruth t;
|
|
|
70 |
KSP ksp;
|
|
|
71 |
|
|
|
72 |
PetscFunctionBegin;
|
|
|
73 |
|
|
|
74 |
/* Check some constraints */
|
|
|
75 |
ierr = STSetUp(eps->OP); CHKERRQ(ierr);
|
|
|
76 |
ierr = STGetKSP(eps->OP, &ksp); CHKERRQ(ierr);
|
|
|
77 |
ierr = PetscTypeCompare((PetscObject)ksp, KSPPREONLY, &t); CHKERRQ(ierr);
|
|
|
78 |
if (t == PETSC_TRUE) SETERRQ(PETSC_ERR_SUP, "jd does not work with preonly ksp of the spectral transformation");
|
|
|
79 |
|
|
|
80 |
/* Setup common for all davidson solvers */
|
|
|
81 |
ierr = EPSSetUp_DAVIDSON(eps);
|
|
|
82 |
|
|
|
83 |
PetscFunctionReturn(0);
|
|
|
84 |
}
|
|
|
85 |
EXTERN_C_END
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
EXTERN_C_BEGIN
|
|
|
89 |
#undef __FUNCT__
|
| 1994 |
eromero |
90 |
#define __FUNCT__ "EPSCreate_JD"
|
|
|
91 |
PetscErrorCode EPSCreate_JD(EPS eps) {
|
| 1976 |
eromero |
92 |
PetscErrorCode ierr;
|
| 2005 |
eromero |
93 |
KSP ksp;
|
| 1976 |
eromero |
94 |
|
|
|
95 |
PetscFunctionBegin;
|
|
|
96 |
|
| 1982 |
eromero |
97 |
/* Load the DAVIDSON solver */
|
|
|
98 |
ierr = EPSCreate_DAVIDSON(eps); CHKERRQ(ierr);
|
| 1976 |
eromero |
99 |
|
| 2005 |
eromero |
100 |
/* Set the default ksp of the st to gmres */
|
|
|
101 |
ierr = STGetKSP(eps->OP, &ksp); CHKERRQ(ierr);
|
|
|
102 |
ierr = KSPSetType(ksp, KSPGMRES); CHKERRQ(ierr);
|
|
|
103 |
|
| 1994 |
eromero |
104 |
/* Overload the JD properties */
|
|
|
105 |
eps->ops->setfromoptions = EPSSetFromOptions_JD;
|
| 2003 |
eromero |
106 |
eps->ops->setup = EPSSetUp_JD;
|
| 1994 |
eromero |
107 |
eps->ops->destroy = EPSDestroy_JD;
|
| 1976 |
eromero |
108 |
|
| 1994 |
eromero |
109 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetKrylovStart_C","EPSDAVIDSONSetKrylovStart_DAVIDSON",EPSDAVIDSONSetKrylovStart_DAVIDSON);CHKERRQ(ierr);
|
|
|
110 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetKrylovStart_C","EPSDAVIDSONGetKrylovStart_DAVIDSON",EPSDAVIDSONGetKrylovStart_DAVIDSON);CHKERRQ(ierr);
|
|
|
111 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetBlockSize_C","EPSDAVIDSONSetBlockSize_DAVIDSON",EPSDAVIDSONSetBlockSize_DAVIDSON);CHKERRQ(ierr);
|
|
|
112 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetBlockSize_C","EPSDAVIDSONGetBlockSize_DAVIDSON",EPSDAVIDSONGetBlockSize_DAVIDSON);CHKERRQ(ierr);
|
|
|
113 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetRestart_C","EPSDAVIDSONSetRestart_DAVIDSON",EPSDAVIDSONSetRestart_DAVIDSON);CHKERRQ(ierr);
|
|
|
114 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetRestart_C","EPSDAVIDSONGetRestart_DAVIDSON",EPSDAVIDSONGetRestart_DAVIDSON);CHKERRQ(ierr);
|
|
|
115 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetInitialSize_C","EPSDAVIDSONSetInitialSize_DAVIDSON",EPSDAVIDSONSetInitialSize_DAVIDSON);CHKERRQ(ierr);
|
|
|
116 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetInitialSize_C","EPSDAVIDSONGetInitialSize_DAVIDSON",EPSDAVIDSONGetInitialSize_DAVIDSON);CHKERRQ(ierr);
|
| 1995 |
eromero |
117 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetFix_C","EPSDAVIDSONSetFix_DAVIDSON",EPSDAVIDSONSetFix_DAVIDSON);CHKERRQ(ierr);
|
|
|
118 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetFix_C","EPSDAVIDSONGetFix_DAVIDSON",EPSDAVIDSONGetFix_DAVIDSON);CHKERRQ(ierr);
|
| 1976 |
eromero |
119 |
|
|
|
120 |
PetscFunctionReturn(0);
|
|
|
121 |
}
|
|
|
122 |
EXTERN_C_END
|
|
|
123 |
|
| 1980 |
eromero |
124 |
EXTERN_C_BEGIN
|
|
|
125 |
#undef __FUNCT__
|
| 1994 |
eromero |
126 |
#define __FUNCT__ "EPSDestroy_JD"
|
|
|
127 |
PetscErrorCode EPSDestroy_JD(EPS eps)
|
| 1992 |
eromero |
128 |
{
|
| 1980 |
eromero |
129 |
PetscErrorCode ierr;
|
| 1976 |
eromero |
130 |
|
| 1980 |
eromero |
131 |
PetscFunctionBegin;
|
|
|
132 |
|
| 1994 |
eromero |
133 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetKrylovStart_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
134 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetKrylovStart_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
135 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetBlockSize_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
136 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetBlockSize_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
137 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetRestart_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
138 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetRestart_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
139 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetInitialSize_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
140 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetInitialSize_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
141 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDSetFix_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
142 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSJDGetFix_C","",PETSC_NULL);CHKERRQ(ierr);
|
| 1980 |
eromero |
143 |
|
| 1992 |
eromero |
144 |
ierr = EPSDestroy_DAVIDSON(eps);
|
|
|
145 |
|
| 1980 |
eromero |
146 |
PetscFunctionReturn(0);
|
|
|
147 |
}
|
|
|
148 |
EXTERN_C_END
|
|
|
149 |
|
|
|
150 |
|
| 1976 |
eromero |
151 |
#undef __FUNCT__
|
| 1994 |
eromero |
152 |
#define __FUNCT__ "EPSJDSetKrylovStart"
|
| 1976 |
eromero |
153 |
/*@
|
| 1994 |
eromero |
154 |
EPSJDSetKrylovStart - Activates or deactivates starting the searching
|
| 1976 |
eromero |
155 |
subspace with a Krylov basis.
|
|
|
156 |
|
|
|
157 |
Collective on EPS
|
|
|
158 |
|
|
|
159 |
Input Parameters:
|
|
|
160 |
+ eps - the eigenproblem solver context
|
|
|
161 |
- krylovstart - boolean flag
|
|
|
162 |
|
|
|
163 |
Options Database Key:
|
| 1994 |
eromero |
164 |
. -eps_jd_krylov_start - Activates starting the searching subspace with a
|
| 1976 |
eromero |
165 |
Krylov basis
|
|
|
166 |
|
|
|
167 |
Level: advanced
|
|
|
168 |
|
| 1994 |
eromero |
169 |
.seealso: EPSJDGetKrylovStart()
|
| 1976 |
eromero |
170 |
@*/
|
| 1994 |
eromero |
171 |
PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscTruth krylovstart)
|
| 1980 |
eromero |
172 |
{
|
|
|
173 |
PetscErrorCode ierr, (*f)(EPS,PetscTruth);
|
| 1976 |
eromero |
174 |
|
| 1980 |
eromero |
175 |
PetscFunctionBegin;
|
|
|
176 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1994 |
eromero |
177 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDSetKrylovStart_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1980 |
eromero |
178 |
if (f) {
|
|
|
179 |
ierr = (*f)(eps,krylovstart);CHKERRQ(ierr);
|
|
|
180 |
}
|
|
|
181 |
PetscFunctionReturn(0);
|
|
|
182 |
}
|
| 1976 |
eromero |
183 |
|
|
|
184 |
#undef __FUNCT__
|
| 1994 |
eromero |
185 |
#define __FUNCT__ "EPSJDGetKrylovStart"
|
| 1985 |
eromero |
186 |
/*@
|
| 1994 |
eromero |
187 |
EPSJDGetKrylovStart - Gets if the searching subspace is started with a
|
| 1976 |
eromero |
188 |
Krylov basis.
|
|
|
189 |
|
|
|
190 |
Collective on EPS
|
|
|
191 |
|
|
|
192 |
Input Parameter:
|
|
|
193 |
. eps - the eigenproblem solver context
|
|
|
194 |
|
| 1994 |
eromero |
195 |
Output Parameters:
|
| 1976 |
eromero |
196 |
. krylovstart - boolean flag indicating if starting the searching subspace
|
|
|
197 |
with a Krylov basis is enabled.
|
|
|
198 |
|
|
|
199 |
Level: advanced
|
|
|
200 |
|
| 1994 |
eromero |
201 |
.seealso: EPSJDGetKrylovStart()
|
| 1976 |
eromero |
202 |
@*/
|
| 1994 |
eromero |
203 |
PetscErrorCode EPSJDGetKrylovStart(EPS eps,PetscTruth *krylovstart)
|
| 1980 |
eromero |
204 |
{
|
|
|
205 |
PetscErrorCode ierr, (*f)(EPS,PetscTruth*);
|
| 1976 |
eromero |
206 |
|
| 1980 |
eromero |
207 |
PetscFunctionBegin;
|
|
|
208 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1994 |
eromero |
209 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDGetKrylovStart_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1980 |
eromero |
210 |
if (f) {
|
|
|
211 |
ierr = (*f)(eps,krylovstart);CHKERRQ(ierr);
|
|
|
212 |
}
|
|
|
213 |
PetscFunctionReturn(0);
|
|
|
214 |
}
|
|
|
215 |
|
| 1976 |
eromero |
216 |
#undef __FUNCT__
|
| 1994 |
eromero |
217 |
#define __FUNCT__ "EPSJDSetBlockSize"
|
| 1976 |
eromero |
218 |
/*@
|
| 1994 |
eromero |
219 |
EPSJDSetBlockSize - Sets the number of vectors added to the searching space
|
| 1976 |
eromero |
220 |
every iteration.
|
|
|
221 |
|
|
|
222 |
Collective on EPS
|
|
|
223 |
|
|
|
224 |
Input Parameters:
|
|
|
225 |
+ eps - the eigenproblem solver context
|
|
|
226 |
- blocksize - non-zero positive integer
|
|
|
227 |
|
|
|
228 |
Options Database Key:
|
| 1994 |
eromero |
229 |
. -eps_jd_blocksize - integer indicating the number of vectors added to the
|
| 1976 |
eromero |
230 |
searching space every iteration.
|
|
|
231 |
|
|
|
232 |
Level: advanced
|
|
|
233 |
|
| 1994 |
eromero |
234 |
.seealso: EPSJDSetKrylovStart()
|
| 1976 |
eromero |
235 |
@*/
|
| 1994 |
eromero |
236 |
PetscErrorCode EPSJDSetBlockSize(EPS eps,PetscInt blocksize)
|
| 1980 |
eromero |
237 |
{
|
|
|
238 |
PetscErrorCode ierr, (*f)(EPS,PetscInt);
|
| 1976 |
eromero |
239 |
|
| 1980 |
eromero |
240 |
PetscFunctionBegin;
|
|
|
241 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1994 |
eromero |
242 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDSetBlockSize_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1980 |
eromero |
243 |
if (f) {
|
|
|
244 |
ierr = (*f)(eps,blocksize);CHKERRQ(ierr);
|
|
|
245 |
}
|
|
|
246 |
PetscFunctionReturn(0);
|
|
|
247 |
}
|
|
|
248 |
|
| 1976 |
eromero |
249 |
#undef __FUNCT__
|
| 1994 |
eromero |
250 |
#define __FUNCT__ "EPSJDGetBlockSize"
|
| 1985 |
eromero |
251 |
/*@
|
| 1994 |
eromero |
252 |
EPSJDGetBlockSize - Gets the number of vectors added to the searching space
|
| 1976 |
eromero |
253 |
every iteration.
|
|
|
254 |
|
|
|
255 |
Collective on EPS
|
|
|
256 |
|
|
|
257 |
Input Parameter:
|
|
|
258 |
. eps - the eigenproblem solver context
|
|
|
259 |
|
| 1994 |
eromero |
260 |
Output Parameter:
|
| 1976 |
eromero |
261 |
. blocksize - integer indicating the number of vectors added to the searching
|
|
|
262 |
space every iteration.
|
|
|
263 |
|
|
|
264 |
Level: advanced
|
|
|
265 |
|
| 1994 |
eromero |
266 |
.seealso: EPSJDSetBlockSize()
|
| 1976 |
eromero |
267 |
@*/
|
| 1994 |
eromero |
268 |
PetscErrorCode EPSJDGetBlockSize(EPS eps,PetscInt *blocksize)
|
| 1980 |
eromero |
269 |
{
|
|
|
270 |
PetscErrorCode ierr, (*f)(EPS,PetscInt*);
|
| 1976 |
eromero |
271 |
|
| 1980 |
eromero |
272 |
PetscFunctionBegin;
|
|
|
273 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1994 |
eromero |
274 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDGetBlockSize_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1980 |
eromero |
275 |
if (f) {
|
|
|
276 |
ierr = (*f)(eps,blocksize);CHKERRQ(ierr);
|
|
|
277 |
}
|
|
|
278 |
PetscFunctionReturn(0);
|
|
|
279 |
}
|
|
|
280 |
|
| 1976 |
eromero |
281 |
#undef __FUNCT__
|
| 1994 |
eromero |
282 |
#define __FUNCT__ "EPSJDGetRestart"
|
| 1985 |
eromero |
283 |
/*@
|
| 1994 |
eromero |
284 |
EPSJDGetRestart - Gets the number of vectors of the searching space after
|
| 1976 |
eromero |
285 |
restarting and the number of vectors saved from the previous iteration.
|
|
|
286 |
|
|
|
287 |
Collective on EPS
|
|
|
288 |
|
|
|
289 |
Input Parameter:
|
|
|
290 |
. eps - the eigenproblem solver context
|
|
|
291 |
|
| 1994 |
eromero |
292 |
Output Parameter:
|
| 1976 |
eromero |
293 |
+ minv - non-zero positive integer indicating the number of vectors of the
|
|
|
294 |
searching subspace after restarting
|
|
|
295 |
- plusk - positive integer indicating the number of vectors saved from the
|
|
|
296 |
previous iteration
|
|
|
297 |
|
|
|
298 |
Level: advanced
|
|
|
299 |
|
| 1994 |
eromero |
300 |
.seealso: EPSJDSetRestart()
|
| 1976 |
eromero |
301 |
@*/
|
| 1994 |
eromero |
302 |
PetscErrorCode EPSJDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
|
| 1980 |
eromero |
303 |
{
|
|
|
304 |
PetscErrorCode ierr, (*f)(EPS,PetscInt*,PetscInt*);
|
| 1976 |
eromero |
305 |
|
| 1980 |
eromero |
306 |
PetscFunctionBegin;
|
|
|
307 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1994 |
eromero |
308 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDGetRestart_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1980 |
eromero |
309 |
if (f) {
|
|
|
310 |
ierr = (*f)(eps,minv,plusk);CHKERRQ(ierr);
|
|
|
311 |
}
|
|
|
312 |
PetscFunctionReturn(0);
|
|
|
313 |
}
|
|
|
314 |
|
| 1976 |
eromero |
315 |
#undef __FUNCT__
|
| 1994 |
eromero |
316 |
#define __FUNCT__ "EPSJDSetRestart"
|
| 1976 |
eromero |
317 |
/*@
|
| 1994 |
eromero |
318 |
EPSJDSetRestart - Sets the number of vectors of the searching space after
|
| 1976 |
eromero |
319 |
restarting and the number of vectors saved from the previous iteration.
|
|
|
320 |
|
|
|
321 |
Collective on EPS
|
|
|
322 |
|
|
|
323 |
Input Parameters:
|
|
|
324 |
+ eps - the eigenproblem solver context
|
|
|
325 |
. minv - non-zero positive integer indicating the number of vectors of the
|
|
|
326 |
searching subspace after restarting
|
|
|
327 |
- plusk - positive integer indicating the number of vectors saved from the
|
|
|
328 |
previous iteration
|
|
|
329 |
|
|
|
330 |
Options Database Key:
|
| 1994 |
eromero |
331 |
+ -eps_jd_minv - non-zero positive integer indicating the number of vectors
|
| 1976 |
eromero |
332 |
of the searching subspace after restarting
|
| 1994 |
eromero |
333 |
- -eps_jd_plusk - positive integer indicating the number of vectors saved
|
| 1976 |
eromero |
334 |
from the previous iteration
|
|
|
335 |
|
|
|
336 |
Level: advanced
|
|
|
337 |
|
| 1994 |
eromero |
338 |
.seealso: EPSJDGetRestart()
|
| 1976 |
eromero |
339 |
@*/
|
| 1994 |
eromero |
340 |
PetscErrorCode EPSJDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
|
| 1980 |
eromero |
341 |
{
|
|
|
342 |
PetscErrorCode ierr, (*f)(EPS,PetscInt,PetscInt);
|
| 1976 |
eromero |
343 |
|
| 1980 |
eromero |
344 |
PetscFunctionBegin;
|
|
|
345 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1994 |
eromero |
346 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDSetRestart_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1980 |
eromero |
347 |
if (f) {
|
|
|
348 |
ierr = (*f)(eps,minv,plusk);CHKERRQ(ierr);
|
|
|
349 |
}
|
|
|
350 |
PetscFunctionReturn(0);
|
|
|
351 |
}
|
| 1976 |
eromero |
352 |
|
| 1980 |
eromero |
353 |
#undef __FUNCT__
|
| 1994 |
eromero |
354 |
#define __FUNCT__ "EPSJDGetInitialSize"
|
| 1985 |
eromero |
355 |
/*@
|
| 1994 |
eromero |
356 |
EPSJDGetInitialSize - Gets the initial size of the searching space. In the
|
| 1980 |
eromero |
357 |
case of EPSGetKrylovStart is PETSC_FALSE and the user provides vectors by
|
|
|
358 |
EPSSetInitialSpace, up to initialsize vectors will be used; and if the
|
|
|
359 |
provided vectors are not enough, the solver completes the subspace with
|
|
|
360 |
random vectors. In the case of EPSGetKrylovStart is PETSC_TRUE, the solver
|
|
|
361 |
gets the first vector provided by the user or, if not, a random vector,
|
|
|
362 |
and expands the Krylov basis up to initialsize vectors.
|
|
|
363 |
|
|
|
364 |
Collective on EPS
|
|
|
365 |
|
|
|
366 |
Input Parameter:
|
|
|
367 |
. eps - the eigenproblem solver context
|
|
|
368 |
|
| 1994 |
eromero |
369 |
Output Parameter:
|
| 1980 |
eromero |
370 |
. initialsize - non-zero positive integer indicating the number of vectors of
|
|
|
371 |
the initial searching subspace
|
|
|
372 |
|
|
|
373 |
Level: advanced
|
|
|
374 |
|
| 1994 |
eromero |
375 |
.seealso: EPSJDSetInitialSize(), EPSGetKrylovStart()
|
| 1980 |
eromero |
376 |
@*/
|
| 1994 |
eromero |
377 |
PetscErrorCode EPSJDGetInitialSize(EPS eps,PetscInt *initialsize)
|
| 1980 |
eromero |
378 |
{
|
|
|
379 |
PetscErrorCode ierr, (*f)(EPS,PetscInt*);
|
|
|
380 |
|
|
|
381 |
PetscFunctionBegin;
|
|
|
382 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1994 |
eromero |
383 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDGetInitialSize_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1980 |
eromero |
384 |
if (f) {
|
|
|
385 |
ierr = (*f)(eps,initialsize);CHKERRQ(ierr);
|
|
|
386 |
}
|
|
|
387 |
PetscFunctionReturn(0);
|
|
|
388 |
}
|
|
|
389 |
|
|
|
390 |
#undef __FUNCT__
|
| 1994 |
eromero |
391 |
#define __FUNCT__ "EPSJDSetInitialSize"
|
| 1980 |
eromero |
392 |
/*@
|
| 1994 |
eromero |
393 |
EPSJDSetInitialSize - Sets the initial size of the searching space. In the
|
| 1980 |
eromero |
394 |
case of EPSGetKrylovStart is PETSC_FALSE and the user provides vectors by
|
|
|
395 |
EPSSetInitialSpace, up to initialsize vectors will be used; and if the
|
|
|
396 |
provided vectors are not enough, the solver completes the subspace with
|
|
|
397 |
random vectors. In the case of EPSGetKrylovStart is PETSC_TRUE, the solver
|
|
|
398 |
gets the first vector provided by the user or, if not, a random vector,
|
|
|
399 |
and expands the Krylov basis up to initialsize vectors.
|
|
|
400 |
|
|
|
401 |
Collective on EPS
|
|
|
402 |
|
| 1994 |
eromero |
403 |
Input Parameters:
|
|
|
404 |
+ eps - the eigenproblem solver context
|
|
|
405 |
- initialsize - non-zero positive integer indicating the number of vectors of
|
| 1980 |
eromero |
406 |
the initial searching subspace
|
|
|
407 |
|
|
|
408 |
Options Database Key:
|
| 1994 |
eromero |
409 |
. -eps_jd_initial_size - non-zero positive integer indicating the number of
|
| 1980 |
eromero |
410 |
vectors of the initial searching subspace
|
|
|
411 |
|
|
|
412 |
Level: advanced
|
|
|
413 |
|
| 1994 |
eromero |
414 |
.seealso: EPSJDGetInitialSize(), EPSGetKrylovStart()
|
| 1980 |
eromero |
415 |
@*/
|
| 1994 |
eromero |
416 |
PetscErrorCode EPSJDSetInitialSize(EPS eps,PetscInt initialsize)
|
| 1980 |
eromero |
417 |
{
|
|
|
418 |
PetscErrorCode ierr, (*f)(EPS,PetscInt);
|
|
|
419 |
|
|
|
420 |
PetscFunctionBegin;
|
|
|
421 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1994 |
eromero |
422 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDSetInitialSize_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1980 |
eromero |
423 |
if (f) {
|
|
|
424 |
ierr = (*f)(eps,initialsize);CHKERRQ(ierr);
|
|
|
425 |
}
|
|
|
426 |
PetscFunctionReturn(0);
|
|
|
427 |
}
|
|
|
428 |
|
| 1994 |
eromero |
429 |
#undef __FUNCT__
|
|
|
430 |
#define __FUNCT__ "EPSJDGetFix"
|
|
|
431 |
/*@
|
|
|
432 |
EPSJDGetFix - Gets the threshold for changing the target in the correction
|
|
|
433 |
equation. The target in the correction equation is fixed at the first
|
|
|
434 |
iterations. When the norm of the residual vector is lower than this value
|
|
|
435 |
the target is set to the corresponding eigenvalue.
|
|
|
436 |
|
|
|
437 |
Collective on EPS
|
|
|
438 |
|
|
|
439 |
Input Parameters:
|
|
|
440 |
+ eps - the eigenproblem solver context
|
|
|
441 |
- fix - positive float number
|
|
|
442 |
|
|
|
443 |
Level: advanced
|
|
|
444 |
|
|
|
445 |
.seealso: EPSJDSetFix()
|
|
|
446 |
@*/
|
|
|
447 |
PetscErrorCode EPSJDGetFix(EPS eps,PetscReal *fix)
|
|
|
448 |
{
|
|
|
449 |
PetscErrorCode ierr, (*f)(EPS,PetscReal*);
|
|
|
450 |
|
|
|
451 |
PetscFunctionBegin;
|
|
|
452 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
|
|
453 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDGetFix_C",(void (**)())&f);CHKERRQ(ierr);
|
|
|
454 |
if (f) {
|
|
|
455 |
ierr = (*f)(eps,fix);CHKERRQ(ierr);
|
|
|
456 |
}
|
|
|
457 |
PetscFunctionReturn(0);
|
|
|
458 |
}
|
|
|
459 |
|
|
|
460 |
#undef __FUNCT__
|
|
|
461 |
#define __FUNCT__ "EPSJDSetFix"
|
|
|
462 |
/*@
|
|
|
463 |
EPSJDSetFix - Sets the threshold for changing the target in the correction
|
|
|
464 |
equation. The target in the correction equation is fixed at the first
|
|
|
465 |
iterations. When the norm of the residual vector is lower than this value
|
|
|
466 |
the target is set to the corresponding eigenvalue.
|
|
|
467 |
|
|
|
468 |
Collective on EPS
|
|
|
469 |
|
|
|
470 |
Input Parameter:
|
|
|
471 |
. eps - the eigenproblem solver context
|
|
|
472 |
|
|
|
473 |
Output Parameter:
|
|
|
474 |
. fix - positive float number
|
|
|
475 |
|
|
|
476 |
Options Database Key:
|
|
|
477 |
. -eps_jd_fix
|
|
|
478 |
|
|
|
479 |
Level: advanced
|
|
|
480 |
|
|
|
481 |
.seealso: EPSJDGetFix()
|
|
|
482 |
@*/
|
|
|
483 |
PetscErrorCode EPSJDSetFix(EPS eps,PetscReal fix)
|
|
|
484 |
{
|
|
|
485 |
PetscErrorCode ierr, (*f)(EPS,PetscReal);
|
|
|
486 |
|
|
|
487 |
PetscFunctionBegin;
|
|
|
488 |
PetscValidHeaderSpecific(eps,EPS_COOKIE,1);
|
| 1995 |
eromero |
489 |
ierr = PetscObjectQueryFunction((PetscObject)eps,"EPSJDSetFix_C",(void (**)())&f);CHKERRQ(ierr);
|
| 1994 |
eromero |
490 |
if (f) {
|
|
|
491 |
ierr = (*f)(eps,fix);CHKERRQ(ierr);
|
|
|
492 |
}
|
|
|
493 |
PetscFunctionReturn(0);
|
|
|
494 |
}
|