| 1976 |
eromero |
1 |
/*
|
| 2110 |
jroman |
2 |
SLEPc eigensolver: "gd"
|
| 1976 |
eromero |
3 |
|
| 2110 |
jroman |
4 |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
5 |
SLEPc - Scalable Library for Eigenvalue Problem Computations
|
| 2575 |
eromero |
6 |
Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain
|
| 1976 |
eromero |
7 |
|
| 2110 |
jroman |
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 |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 1976 |
eromero |
22 |
*/
|
|
|
23 |
|
| 2729 |
jroman |
24 |
#include "slepc-private/epsimpl.h" /*I "slepceps.h" I*/
|
| 2283 |
jroman |
25 |
#include <../src/eps/impls/davidson/common/davidson.h>
|
| 1976 |
eromero |
26 |
|
| 2003 |
eromero |
27 |
PetscErrorCode EPSSetUp_GD(EPS eps);
|
| 1992 |
eromero |
28 |
PetscErrorCode EPSDestroy_GD(EPS eps);
|
| 1976 |
eromero |
29 |
|
|
|
30 |
EXTERN_C_BEGIN
|
|
|
31 |
#undef __FUNCT__
|
|
|
32 |
#define __FUNCT__ "EPSSetFromOptions_GD"
|
|
|
33 |
PetscErrorCode EPSSetFromOptions_GD(EPS eps)
|
|
|
34 |
{
|
| 2317 |
jroman |
35 |
PetscErrorCode ierr;
|
|
|
36 |
PetscBool flg,op;
|
|
|
37 |
PetscInt opi,opi0;
|
| 2616 |
eromero |
38 |
KSP ksp;
|
| 1976 |
eromero |
39 |
|
|
|
40 |
PetscFunctionBegin;
|
| 2384 |
jroman |
41 |
ierr = PetscOptionsHead("EPS Generalized Davidson (GD) Options");CHKERRQ(ierr);
|
| 1976 |
eromero |
42 |
|
| 2331 |
jroman |
43 |
ierr = EPSGDGetKrylovStart(eps,&op);CHKERRQ(ierr);
|
| 2330 |
jroman |
44 |
ierr = PetscOptionsBool("-eps_gd_krylov_start","Start the searching subspace with a krylov basis","EPSGDSetKrylovStart",op,&op,&flg);CHKERRQ(ierr);
|
| 2331 |
jroman |
45 |
if(flg) { ierr = EPSGDSetKrylovStart(eps,op);CHKERRQ(ierr); }
|
| 2555 |
eromero |
46 |
|
|
|
47 |
ierr = EPSGDGetBOrth(eps,&op);CHKERRQ(ierr);
|
|
|
48 |
ierr = PetscOptionsBool("-eps_gd_borth","B-orthogonalize the searching subspace basis","EPSGDSetBOrth",op,&op,&flg);CHKERRQ(ierr);
|
|
|
49 |
if(flg) { ierr = EPSGDSetBOrth(eps,op);CHKERRQ(ierr); }
|
| 1976 |
eromero |
50 |
|
| 2331 |
jroman |
51 |
ierr = EPSGDGetBlockSize(eps,&opi);CHKERRQ(ierr);
|
| 2330 |
jroman |
52 |
ierr = PetscOptionsInt("-eps_gd_blocksize","Number vectors add to the searching subspace","EPSGDSetBlockSize",opi,&opi,&flg);CHKERRQ(ierr);
|
| 2331 |
jroman |
53 |
if(flg) { ierr = EPSGDSetBlockSize(eps,opi);CHKERRQ(ierr); }
|
| 1976 |
eromero |
54 |
|
| 2331 |
jroman |
55 |
ierr = EPSGDGetRestart(eps,&opi,&opi0);CHKERRQ(ierr);
|
| 2330 |
jroman |
56 |
ierr = PetscOptionsInt("-eps_gd_minv","Set the size of the searching subspace after restarting","EPSGDSetRestart",opi,&opi,&flg);CHKERRQ(ierr);
|
| 2331 |
jroman |
57 |
if(flg) { ierr = EPSGDSetRestart(eps,opi,opi0);CHKERRQ(ierr); }
|
| 1976 |
eromero |
58 |
|
| 2330 |
jroman |
59 |
ierr = PetscOptionsInt("-eps_gd_plusk","Set the number of saved eigenvectors from the previous iteration when restarting","EPSGDSetRestart",opi0,&opi0,&flg);CHKERRQ(ierr);
|
| 2331 |
jroman |
60 |
if(flg) { ierr = EPSGDSetRestart(eps,opi,opi0);CHKERRQ(ierr); }
|
| 1976 |
eromero |
61 |
|
| 2331 |
jroman |
62 |
ierr = EPSGDGetInitialSize(eps,&opi);CHKERRQ(ierr);
|
| 2330 |
jroman |
63 |
ierr = PetscOptionsInt("-eps_gd_initial_size","Set the initial size of the searching subspace","EPSGDSetInitialSize",opi,&opi,&flg);CHKERRQ(ierr);
|
| 2331 |
jroman |
64 |
if(flg) { ierr = EPSGDSetInitialSize(eps,opi);CHKERRQ(ierr); }
|
| 1980 |
eromero |
65 |
|
| 2611 |
eromero |
66 |
ierr = EPSGDGetWindowSizes(eps,&opi,&opi0);CHKERRQ(ierr);
|
| 2630 |
eromero |
67 |
ierr = PetscOptionsInt("-eps_gd_pwindow","(Experimental!) Set the number of converged vectors in the projector","EPSGDSetWindowSizes",opi,&opi,&flg);CHKERRQ(ierr);
|
| 2611 |
eromero |
68 |
if(flg) { ierr = EPSGDSetWindowSizes(eps,opi,opi0);CHKERRQ(ierr); }
|
|
|
69 |
|
| 2630 |
eromero |
70 |
ierr = PetscOptionsInt("-eps_gd_qwindow","(Experimental!) Set the number of converged vectors in the projected problem","EPSGDSetWindowSizes",opi0,&opi0,&flg);CHKERRQ(ierr);
|
| 2611 |
eromero |
71 |
if(flg) { ierr = EPSGDSetWindowSizes(eps,opi,opi0);CHKERRQ(ierr); }
|
|
|
72 |
|
| 2384 |
jroman |
73 |
ierr = PetscOptionsTail();CHKERRQ(ierr);
|
| 2616 |
eromero |
74 |
|
|
|
75 |
/* Set STPrecond as the default ST */
|
|
|
76 |
if (!((PetscObject)eps->OP)->type_name) {
|
|
|
77 |
ierr = STSetType(eps->OP,STPRECOND);CHKERRQ(ierr);
|
|
|
78 |
}
|
|
|
79 |
ierr = STPrecondSetKSPHasMat(eps->OP,PETSC_FALSE);CHKERRQ(ierr);
|
|
|
80 |
|
|
|
81 |
/* Set the default options of the KSP */
|
|
|
82 |
ierr = STGetKSP(eps->OP,&ksp);CHKERRQ(ierr);
|
|
|
83 |
if (!((PetscObject)ksp)->type_name) {
|
|
|
84 |
ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr);
|
|
|
85 |
}
|
|
|
86 |
|
| 1976 |
eromero |
87 |
PetscFunctionReturn(0);
|
|
|
88 |
}
|
|
|
89 |
EXTERN_C_END
|
|
|
90 |
|
|
|
91 |
#undef __FUNCT__
|
| 2003 |
eromero |
92 |
#define __FUNCT__ "EPSSetUp_GD"
|
|
|
93 |
PetscErrorCode EPSSetUp_GD(EPS eps)
|
|
|
94 |
{
|
| 2317 |
jroman |
95 |
PetscErrorCode ierr;
|
|
|
96 |
PetscBool t;
|
|
|
97 |
KSP ksp;
|
| 2003 |
eromero |
98 |
|
|
|
99 |
PetscFunctionBegin;
|
| 2104 |
eromero |
100 |
/* Setup common for all davidson solvers */
|
| 2330 |
jroman |
101 |
ierr = EPSSetUp_Davidson(eps);CHKERRQ(ierr);
|
| 2104 |
eromero |
102 |
|
| 2616 |
eromero |
103 |
/* Set KSPPREONLY as default */
|
|
|
104 |
ierr = STGetKSP(eps->OP,&ksp);CHKERRQ(ierr);
|
|
|
105 |
if (!((PetscObject)ksp)->type_name) {
|
|
|
106 |
ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr);
|
|
|
107 |
}
|
|
|
108 |
|
| 2003 |
eromero |
109 |
/* Check some constraints */
|
| 2331 |
jroman |
110 |
ierr = PetscTypeCompare((PetscObject)ksp,KSPPREONLY,&t);CHKERRQ(ierr);
|
|
|
111 |
if (!t) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"EPSGD only works with KSPPREONLY");
|
| 2003 |
eromero |
112 |
PetscFunctionReturn(0);
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
EXTERN_C_BEGIN
|
|
|
116 |
#undef __FUNCT__
|
| 1976 |
eromero |
117 |
#define __FUNCT__ "EPSCreate_GD"
|
| 2317 |
jroman |
118 |
PetscErrorCode EPSCreate_GD(EPS eps)
|
|
|
119 |
{
|
| 1976 |
eromero |
120 |
PetscErrorCode ierr;
|
|
|
121 |
|
|
|
122 |
PetscFunctionBegin;
|
| 2324 |
jroman |
123 |
/* Load the Davidson solver */
|
| 2330 |
jroman |
124 |
ierr = EPSCreate_Davidson(eps);CHKERRQ(ierr);
|
| 2650 |
eromero |
125 |
ierr = EPSDavidsonSetFix_Davidson(eps,0.0);CHKERRQ(ierr);
|
| 1976 |
eromero |
126 |
|
| 1982 |
eromero |
127 |
/* Overload the GD properties */
|
| 1976 |
eromero |
128 |
eps->ops->setfromoptions = EPSSetFromOptions_GD;
|
| 2003 |
eromero |
129 |
eps->ops->setup = EPSSetUp_GD;
|
| 1992 |
eromero |
130 |
eps->ops->destroy = EPSDestroy_GD;
|
| 1976 |
eromero |
131 |
|
| 2324 |
jroman |
132 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetKrylovStart_C","EPSDavidsonSetKrylovStart_Davidson",EPSDavidsonSetKrylovStart_Davidson);CHKERRQ(ierr);
|
|
|
133 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetKrylovStart_C","EPSDavidsonGetKrylovStart_Davidson",EPSDavidsonGetKrylovStart_Davidson);CHKERRQ(ierr);
|
| 2555 |
eromero |
134 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBOrth_C","EPSDavidsonSetBOrth_Davidson",EPSDavidsonSetBOrth_Davidson);CHKERRQ(ierr);
|
|
|
135 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBOrth_C","EPSDavidsonGetBOrth_Davidson",EPSDavidsonGetBOrth_Davidson);CHKERRQ(ierr);
|
| 2324 |
jroman |
136 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBlockSize_C","EPSDavidsonSetBlockSize_Davidson",EPSDavidsonSetBlockSize_Davidson);CHKERRQ(ierr);
|
|
|
137 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBlockSize_C","EPSDavidsonGetBlockSize_Davidson",EPSDavidsonGetBlockSize_Davidson);CHKERRQ(ierr);
|
|
|
138 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetRestart_C","EPSDavidsonSetRestart_Davidson",EPSDavidsonSetRestart_Davidson);CHKERRQ(ierr);
|
|
|
139 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetRestart_C","EPSDavidsonGetRestart_Davidson",EPSDavidsonGetRestart_Davidson);CHKERRQ(ierr);
|
|
|
140 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetInitialSize_C","EPSDavidsonSetInitialSize_Davidson",EPSDavidsonSetInitialSize_Davidson);CHKERRQ(ierr);
|
|
|
141 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetInitialSize_C","EPSDavidsonGetInitialSize_Davidson",EPSDavidsonGetInitialSize_Davidson);CHKERRQ(ierr);
|
| 2611 |
eromero |
142 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetWindowSizes_C","EPSDavidsonSetWindowSizes_Davidson",EPSDavidsonSetWindowSizes_Davidson);CHKERRQ(ierr);
|
|
|
143 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetWindowSizes_C","EPSDavidsonGetWindowSizes_Davidson",EPSDavidsonGetWindowSizes_Davidson);CHKERRQ(ierr);
|
| 1976 |
eromero |
144 |
PetscFunctionReturn(0);
|
|
|
145 |
}
|
|
|
146 |
EXTERN_C_END
|
|
|
147 |
|
| 1980 |
eromero |
148 |
#undef __FUNCT__
|
| 1992 |
eromero |
149 |
#define __FUNCT__ "EPSDestroy_GD"
|
|
|
150 |
PetscErrorCode EPSDestroy_GD(EPS eps)
|
|
|
151 |
{
|
| 1980 |
eromero |
152 |
PetscErrorCode ierr;
|
| 1976 |
eromero |
153 |
|
| 1980 |
eromero |
154 |
PetscFunctionBegin;
|
| 2348 |
jroman |
155 |
ierr = PetscFree(eps->data);CHKERRQ(ierr);
|
| 1980 |
eromero |
156 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetKrylovStart_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
157 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetKrylovStart_C","",PETSC_NULL);CHKERRQ(ierr);
|
| 2555 |
eromero |
158 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBOrth_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
159 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBOrth_C","",PETSC_NULL);CHKERRQ(ierr);
|
| 1980 |
eromero |
160 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBlockSize_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
161 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBlockSize_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
162 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetRestart_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
163 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetRestart_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
164 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetInitialSize_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
165 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetInitialSize_C","",PETSC_NULL);CHKERRQ(ierr);
|
| 2611 |
eromero |
166 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetWindowSizes_C","",PETSC_NULL);CHKERRQ(ierr);
|
|
|
167 |
ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetWindowSizes_C","",PETSC_NULL);CHKERRQ(ierr);
|
| 1980 |
eromero |
168 |
PetscFunctionReturn(0);
|
|
|
169 |
}
|
|
|
170 |
|
| 1976 |
eromero |
171 |
#undef __FUNCT__
|
|
|
172 |
#define __FUNCT__ "EPSGDSetKrylovStart"
|
|
|
173 |
/*@
|
|
|
174 |
EPSGDSetKrylovStart - Activates or deactivates starting the searching
|
|
|
175 |
subspace with a Krylov basis.
|
|
|
176 |
|
| 2328 |
jroman |
177 |
Logically Collective on EPS
|
| 1976 |
eromero |
178 |
|
|
|
179 |
Input Parameters:
|
|
|
180 |
+ eps - the eigenproblem solver context
|
|
|
181 |
- krylovstart - boolean flag
|
|
|
182 |
|
|
|
183 |
Options Database Key:
|
| 2328 |
jroman |
184 |
. -eps_gd_krylov_start - Activates starting the searching subspace with a
|
| 1976 |
eromero |
185 |
Krylov basis
|
|
|
186 |
|
|
|
187 |
Level: advanced
|
|
|
188 |
|
|
|
189 |
.seealso: EPSGDGetKrylovStart()
|
|
|
190 |
@*/
|
| 2216 |
jroman |
191 |
PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart)
|
| 1980 |
eromero |
192 |
{
|
| 2221 |
jroman |
193 |
PetscErrorCode ierr;
|
| 1976 |
eromero |
194 |
|
| 1980 |
eromero |
195 |
PetscFunctionBegin;
|
| 2213 |
jroman |
196 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
197 |
PetscValidLogicalCollectiveBool(eps,krylovstart,2);
|
| 2221 |
jroman |
198 |
ierr = PetscTryMethod(eps,"EPSGDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));CHKERRQ(ierr);
|
| 1980 |
eromero |
199 |
PetscFunctionReturn(0);
|
|
|
200 |
}
|
| 1976 |
eromero |
201 |
|
|
|
202 |
#undef __FUNCT__
|
|
|
203 |
#define __FUNCT__ "EPSGDGetKrylovStart"
|
| 1985 |
eromero |
204 |
/*@
|
| 2328 |
jroman |
205 |
EPSGDGetKrylovStart - Returns a flag indicating if the search subspace is started with a
|
| 1976 |
eromero |
206 |
Krylov basis.
|
|
|
207 |
|
| 2328 |
jroman |
208 |
Not Collective
|
| 1976 |
eromero |
209 |
|
|
|
210 |
Input Parameter:
|
|
|
211 |
. eps - the eigenproblem solver context
|
|
|
212 |
|
| 1994 |
eromero |
213 |
Output Parameters:
|
| 2328 |
jroman |
214 |
. krylovstart - boolean flag indicating if the search subspace is started
|
|
|
215 |
with a Krylov basis
|
| 1976 |
eromero |
216 |
|
|
|
217 |
Level: advanced
|
|
|
218 |
|
|
|
219 |
.seealso: EPSGDGetKrylovStart()
|
|
|
220 |
@*/
|
| 2216 |
jroman |
221 |
PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart)
|
| 1980 |
eromero |
222 |
{
|
| 2221 |
jroman |
223 |
PetscErrorCode ierr;
|
| 1976 |
eromero |
224 |
|
| 1980 |
eromero |
225 |
PetscFunctionBegin;
|
| 2213 |
jroman |
226 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
227 |
PetscValidPointer(krylovstart,2);
|
| 2221 |
jroman |
228 |
ierr = PetscTryMethod(eps,"EPSGDGetKrylovStart_C",(EPS,PetscBool*),(eps,krylovstart));CHKERRQ(ierr);
|
| 1980 |
eromero |
229 |
PetscFunctionReturn(0);
|
|
|
230 |
}
|
|
|
231 |
|
| 1976 |
eromero |
232 |
#undef __FUNCT__
|
|
|
233 |
#define __FUNCT__ "EPSGDSetBlockSize"
|
|
|
234 |
/*@
|
| 2328 |
jroman |
235 |
EPSGDSetBlockSize - Sets the number of vectors to be added to the searching space
|
|
|
236 |
in every iteration.
|
| 1976 |
eromero |
237 |
|
| 2328 |
jroman |
238 |
Logically Collective on EPS
|
| 1976 |
eromero |
239 |
|
|
|
240 |
Input Parameters:
|
|
|
241 |
+ eps - the eigenproblem solver context
|
| 2328 |
jroman |
242 |
- blocksize - number of vectors added to the search space in every iteration
|
| 1976 |
eromero |
243 |
|
|
|
244 |
Options Database Key:
|
| 2328 |
jroman |
245 |
. -eps_gd_blocksize - number of vectors added to the search space in every iteration
|
| 1976 |
eromero |
246 |
|
|
|
247 |
Level: advanced
|
|
|
248 |
|
|
|
249 |
.seealso: EPSGDSetKrylovStart()
|
|
|
250 |
@*/
|
| 1980 |
eromero |
251 |
PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize)
|
|
|
252 |
{
|
| 2221 |
jroman |
253 |
PetscErrorCode ierr;
|
| 1976 |
eromero |
254 |
|
| 1980 |
eromero |
255 |
PetscFunctionBegin;
|
| 2213 |
jroman |
256 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
257 |
PetscValidLogicalCollectiveInt(eps,blocksize,2);
|
| 2221 |
jroman |
258 |
ierr = PetscTryMethod(eps,"EPSGDSetBlockSize_C",(EPS,PetscInt),(eps,blocksize));CHKERRQ(ierr);
|
| 1980 |
eromero |
259 |
PetscFunctionReturn(0);
|
|
|
260 |
}
|
|
|
261 |
|
| 1976 |
eromero |
262 |
#undef __FUNCT__
|
|
|
263 |
#define __FUNCT__ "EPSGDGetBlockSize"
|
| 1985 |
eromero |
264 |
/*@
|
| 2328 |
jroman |
265 |
EPSGDGetBlockSize - Returns the number of vectors to be added to the searching space
|
|
|
266 |
in every iteration.
|
| 1976 |
eromero |
267 |
|
| 2328 |
jroman |
268 |
Not Collective
|
| 1976 |
eromero |
269 |
|
|
|
270 |
Input Parameter:
|
|
|
271 |
. eps - the eigenproblem solver context
|
|
|
272 |
|
| 1994 |
eromero |
273 |
Output Parameter:
|
| 2328 |
jroman |
274 |
. blocksize - number of vectors added to the search space in every iteration
|
| 1976 |
eromero |
275 |
|
|
|
276 |
Level: advanced
|
|
|
277 |
|
|
|
278 |
.seealso: EPSGDSetBlockSize()
|
|
|
279 |
@*/
|
| 1980 |
eromero |
280 |
PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize)
|
|
|
281 |
{
|
| 2221 |
jroman |
282 |
PetscErrorCode ierr;
|
| 1976 |
eromero |
283 |
|
| 1980 |
eromero |
284 |
PetscFunctionBegin;
|
| 2213 |
jroman |
285 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
286 |
PetscValidIntPointer(blocksize,2);
|
| 2221 |
jroman |
287 |
ierr = PetscTryMethod(eps,"EPSGDGetBlockSize_C",(EPS,PetscInt*),(eps,blocksize));CHKERRQ(ierr);
|
| 1980 |
eromero |
288 |
PetscFunctionReturn(0);
|
|
|
289 |
}
|
|
|
290 |
|
| 1976 |
eromero |
291 |
#undef __FUNCT__
|
|
|
292 |
#define __FUNCT__ "EPSGDGetRestart"
|
| 1985 |
eromero |
293 |
/*@
|
| 1976 |
eromero |
294 |
EPSGDGetRestart - Gets the number of vectors of the searching space after
|
|
|
295 |
restarting and the number of vectors saved from the previous iteration.
|
|
|
296 |
|
| 2328 |
jroman |
297 |
Not Collective
|
| 1976 |
eromero |
298 |
|
|
|
299 |
Input Parameter:
|
|
|
300 |
. eps - the eigenproblem solver context
|
|
|
301 |
|
| 1994 |
eromero |
302 |
Output Parameter:
|
| 2328 |
jroman |
303 |
+ minv - number of vectors of the searching subspace after restarting
|
|
|
304 |
- plusk - number of vectors saved from the previous iteration
|
| 1976 |
eromero |
305 |
|
|
|
306 |
Level: advanced
|
|
|
307 |
|
|
|
308 |
.seealso: EPSGDSetRestart()
|
|
|
309 |
@*/
|
| 1980 |
eromero |
310 |
PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
|
|
|
311 |
{
|
| 2221 |
jroman |
312 |
PetscErrorCode ierr;
|
| 1976 |
eromero |
313 |
|
| 1980 |
eromero |
314 |
PetscFunctionBegin;
|
| 2213 |
jroman |
315 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
316 |
PetscValidIntPointer(minv,2);
|
|
|
317 |
PetscValidIntPointer(plusk,3);
|
| 2221 |
jroman |
318 |
ierr = PetscTryMethod(eps,"EPSGDGetRestart_C",(EPS,PetscInt*,PetscInt*),(eps,minv,plusk));CHKERRQ(ierr);
|
| 1980 |
eromero |
319 |
PetscFunctionReturn(0);
|
|
|
320 |
}
|
|
|
321 |
|
| 1976 |
eromero |
322 |
#undef __FUNCT__
|
|
|
323 |
#define __FUNCT__ "EPSGDSetRestart"
|
|
|
324 |
/*@
|
|
|
325 |
EPSGDSetRestart - Sets the number of vectors of the searching space after
|
|
|
326 |
restarting and the number of vectors saved from the previous iteration.
|
|
|
327 |
|
| 2328 |
jroman |
328 |
Logically Collective on EPS
|
| 1976 |
eromero |
329 |
|
|
|
330 |
Input Parameters:
|
|
|
331 |
+ eps - the eigenproblem solver context
|
| 2328 |
jroman |
332 |
. minv - number of vectors of the searching subspace after restarting
|
|
|
333 |
- plusk - number of vectors saved from the previous iteration
|
| 1976 |
eromero |
334 |
|
| 2328 |
jroman |
335 |
Options Database Keys:
|
|
|
336 |
+ -eps_gd_minv - number of vectors of the searching subspace after restarting
|
|
|
337 |
- -eps_gd_plusk - number of vectors saved from the previous iteration
|
| 1976 |
eromero |
338 |
|
|
|
339 |
Level: advanced
|
|
|
340 |
|
|
|
341 |
.seealso: EPSGDSetRestart()
|
|
|
342 |
@*/
|
| 1980 |
eromero |
343 |
PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
|
|
|
344 |
{
|
| 2221 |
jroman |
345 |
PetscErrorCode ierr;
|
| 1976 |
eromero |
346 |
|
| 1980 |
eromero |
347 |
PetscFunctionBegin;
|
| 2213 |
jroman |
348 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
349 |
PetscValidLogicalCollectiveInt(eps,minv,2);
|
|
|
350 |
PetscValidLogicalCollectiveInt(eps,plusk,2);
|
| 2221 |
jroman |
351 |
ierr = PetscTryMethod(eps,"EPSGDSetRestart_C",(EPS,PetscInt,PetscInt),(eps,minv,plusk));CHKERRQ(ierr);
|
| 1980 |
eromero |
352 |
PetscFunctionReturn(0);
|
|
|
353 |
}
|
| 1976 |
eromero |
354 |
|
| 1980 |
eromero |
355 |
#undef __FUNCT__
|
|
|
356 |
#define __FUNCT__ "EPSGDGetInitialSize"
|
| 1985 |
eromero |
357 |
/*@
|
| 2328 |
jroman |
358 |
EPSGDGetInitialSize - Returns the initial size of the searching space.
|
| 1980 |
eromero |
359 |
|
| 2328 |
jroman |
360 |
Not Collective
|
| 1980 |
eromero |
361 |
|
|
|
362 |
Input Parameter:
|
|
|
363 |
. eps - the eigenproblem solver context
|
|
|
364 |
|
| 1994 |
eromero |
365 |
Output Parameter:
|
| 2328 |
jroman |
366 |
. initialsize - number of vectors of the initial searching subspace
|
| 1980 |
eromero |
367 |
|
| 2328 |
jroman |
368 |
Notes:
|
| 2644 |
jroman |
369 |
If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with
|
|
|
370 |
EPSSetInitialSpace(), up to initialsize vectors will be used; and if the
|
| 2328 |
jroman |
371 |
provided vectors are not enough, the solver completes the subspace with
|
| 2644 |
jroman |
372 |
random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver
|
| 2328 |
jroman |
373 |
gets the first vector provided by the user or, if not available, a random vector,
|
|
|
374 |
and expands the Krylov basis up to initialsize vectors.
|
|
|
375 |
|
| 1980 |
eromero |
376 |
Level: advanced
|
|
|
377 |
|
| 2242 |
jroman |
378 |
.seealso: EPSGDSetInitialSize(), EPSGDGetKrylovStart()
|
| 1980 |
eromero |
379 |
@*/
|
|
|
380 |
PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize)
|
|
|
381 |
{
|
| 2221 |
jroman |
382 |
PetscErrorCode ierr;
|
| 1980 |
eromero |
383 |
|
|
|
384 |
PetscFunctionBegin;
|
| 2213 |
jroman |
385 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
386 |
PetscValidIntPointer(initialsize,2);
|
| 2221 |
jroman |
387 |
ierr = PetscTryMethod(eps,"EPSGDGetInitialSize_C",(EPS,PetscInt*),(eps,initialsize));CHKERRQ(ierr);
|
| 1980 |
eromero |
388 |
PetscFunctionReturn(0);
|
|
|
389 |
}
|
|
|
390 |
|
|
|
391 |
#undef __FUNCT__
|
|
|
392 |
#define __FUNCT__ "EPSGDSetInitialSize"
|
|
|
393 |
/*@
|
| 2328 |
jroman |
394 |
EPSGDSetInitialSize - Sets the initial size of the searching space.
|
| 1980 |
eromero |
395 |
|
| 2328 |
jroman |
396 |
Logically Collective on EPS
|
| 1980 |
eromero |
397 |
|
| 1994 |
eromero |
398 |
Input Parameters:
|
|
|
399 |
+ eps - the eigenproblem solver context
|
| 2328 |
jroman |
400 |
- initialsize - number of vectors of the initial searching subspace
|
| 1980 |
eromero |
401 |
|
|
|
402 |
Options Database Key:
|
| 2328 |
jroman |
403 |
. -eps_gd_initial_size - number of vectors of the initial searching subspace
|
| 1980 |
eromero |
404 |
|
| 2328 |
jroman |
405 |
Notes:
|
| 2644 |
jroman |
406 |
If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with
|
|
|
407 |
EPSSetInitialSpace(), up to initialsize vectors will be used; and if the
|
| 2328 |
jroman |
408 |
provided vectors are not enough, the solver completes the subspace with
|
| 2644 |
jroman |
409 |
random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver
|
| 2328 |
jroman |
410 |
gets the first vector provided by the user or, if not available, a random vector,
|
|
|
411 |
and expands the Krylov basis up to initialsize vectors.
|
|
|
412 |
|
| 1980 |
eromero |
413 |
Level: advanced
|
|
|
414 |
|
| 2242 |
jroman |
415 |
.seealso: EPSGDGetInitialSize(), EPSGDGetKrylovStart()
|
| 1980 |
eromero |
416 |
@*/
|
|
|
417 |
PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize)
|
|
|
418 |
{
|
| 2221 |
jroman |
419 |
PetscErrorCode ierr;
|
| 1980 |
eromero |
420 |
|
|
|
421 |
PetscFunctionBegin;
|
| 2213 |
jroman |
422 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
423 |
PetscValidLogicalCollectiveInt(eps,initialsize,2);
|
| 2221 |
jroman |
424 |
ierr = PetscTryMethod(eps,"EPSGDSetInitialSize_C",(EPS,PetscInt),(eps,initialsize));CHKERRQ(ierr);
|
| 1980 |
eromero |
425 |
PetscFunctionReturn(0);
|
|
|
426 |
}
|
|
|
427 |
|
| 2555 |
eromero |
428 |
#undef __FUNCT__
|
|
|
429 |
#define __FUNCT__ "EPSGDSetBOrth"
|
|
|
430 |
/*@
|
|
|
431 |
EPSGDSetBOrth - Activates or deactivates the B-orthogonalizetion of the searching
|
|
|
432 |
subspace in case of generalized Hermitian problems.
|
|
|
433 |
|
|
|
434 |
Logically Collective on EPS
|
|
|
435 |
|
|
|
436 |
Input Parameters:
|
|
|
437 |
+ eps - the eigenproblem solver context
|
|
|
438 |
- borth - boolean flag
|
|
|
439 |
|
|
|
440 |
Options Database Key:
|
|
|
441 |
. -eps_gd_borth - Activates the B-orthogonalization of the searching subspace
|
|
|
442 |
|
|
|
443 |
Level: advanced
|
|
|
444 |
|
|
|
445 |
.seealso: EPSGDGetBOrth()
|
|
|
446 |
@*/
|
|
|
447 |
PetscErrorCode EPSGDSetBOrth(EPS eps,PetscBool borth)
|
|
|
448 |
{
|
|
|
449 |
PetscErrorCode ierr;
|
|
|
450 |
|
|
|
451 |
PetscFunctionBegin;
|
|
|
452 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
|
|
453 |
PetscValidLogicalCollectiveBool(eps,borth,2);
|
|
|
454 |
ierr = PetscTryMethod(eps,"EPSGDSetBOrth_C",(EPS,PetscBool),(eps,borth));CHKERRQ(ierr);
|
|
|
455 |
PetscFunctionReturn(0);
|
|
|
456 |
}
|
|
|
457 |
|
|
|
458 |
#undef __FUNCT__
|
|
|
459 |
#define __FUNCT__ "EPSGDGetBOrth"
|
|
|
460 |
/*@
|
|
|
461 |
EPSGDGetBOrth - Returns a flag indicating if the search subspace basis is
|
|
|
462 |
B-orthogonalized.
|
|
|
463 |
|
|
|
464 |
Not Collective
|
|
|
465 |
|
|
|
466 |
Input Parameter:
|
|
|
467 |
. eps - the eigenproblem solver context
|
|
|
468 |
|
|
|
469 |
Output Parameters:
|
|
|
470 |
. borth - the boolean flag
|
|
|
471 |
|
|
|
472 |
Level: advanced
|
|
|
473 |
|
|
|
474 |
.seealso: EPSGDGetKrylovStart()
|
|
|
475 |
@*/
|
|
|
476 |
PetscErrorCode EPSGDGetBOrth(EPS eps,PetscBool *borth)
|
|
|
477 |
{
|
|
|
478 |
PetscErrorCode ierr;
|
|
|
479 |
|
|
|
480 |
PetscFunctionBegin;
|
|
|
481 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
|
|
482 |
PetscValidPointer(borth,2);
|
|
|
483 |
ierr = PetscTryMethod(eps,"EPSGDGetBOrth_C",(EPS,PetscBool*),(eps,borth));CHKERRQ(ierr);
|
|
|
484 |
PetscFunctionReturn(0);
|
|
|
485 |
}
|
| 2611 |
eromero |
486 |
|
|
|
487 |
#undef __FUNCT__
|
|
|
488 |
#define __FUNCT__ "EPSGDGetWindowSizes"
|
|
|
489 |
/*@
|
|
|
490 |
EPSGDGetWindowSizes - Gets the number of converged vectors in the projected
|
|
|
491 |
problem (or Rayleigh quotient) and in the projector employed in the correction
|
|
|
492 |
equation.
|
|
|
493 |
|
|
|
494 |
Not Collective
|
|
|
495 |
|
|
|
496 |
Input Parameter:
|
|
|
497 |
. eps - the eigenproblem solver context
|
|
|
498 |
|
|
|
499 |
Output Parameter:
|
|
|
500 |
+ pwindow - number of converged vectors in the projector
|
|
|
501 |
- qwindow - number of converged vectors in the projected problem
|
|
|
502 |
|
|
|
503 |
Level: advanced
|
|
|
504 |
|
|
|
505 |
.seealso: EPSGDSetWindowSizes()
|
|
|
506 |
@*/
|
|
|
507 |
PetscErrorCode EPSGDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow)
|
|
|
508 |
{
|
|
|
509 |
PetscErrorCode ierr;
|
|
|
510 |
|
|
|
511 |
PetscFunctionBegin;
|
|
|
512 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
|
|
513 |
PetscValidIntPointer(pwindow,2);
|
|
|
514 |
PetscValidIntPointer(qwindow,3);
|
|
|
515 |
ierr = PetscTryMethod(eps,"EPSGDGetWindowSizes_C",(EPS,PetscInt*,PetscInt*),(eps,pwindow,qwindow));CHKERRQ(ierr);
|
|
|
516 |
PetscFunctionReturn(0);
|
|
|
517 |
}
|
|
|
518 |
|
|
|
519 |
#undef __FUNCT__
|
|
|
520 |
#define __FUNCT__ "EPSGDSetWindowSizes"
|
|
|
521 |
/*@
|
|
|
522 |
EPSGDSetWindowSizes - Sets the number of converged vectors in the projected
|
|
|
523 |
problem (or Rayleigh quotient) and in the projector employed in the correction
|
|
|
524 |
equation.
|
|
|
525 |
|
|
|
526 |
Logically Collective on EPS
|
|
|
527 |
|
|
|
528 |
Input Parameters:
|
|
|
529 |
+ eps - the eigenproblem solver context
|
|
|
530 |
. pwindow - number of converged vectors in the projector
|
|
|
531 |
- qwindow - number of converged vectors in the projected problem
|
|
|
532 |
|
|
|
533 |
Options Database Keys:
|
|
|
534 |
+ -eps_gd_pwindow - set the number of converged vectors in the projector
|
|
|
535 |
- -eps_gd_qwindow - set the number of converged vectors in the projected problem
|
|
|
536 |
|
|
|
537 |
Level: advanced
|
|
|
538 |
|
|
|
539 |
.seealso: EPSGDGetWindowSizes()
|
|
|
540 |
@*/
|
|
|
541 |
PetscErrorCode EPSGDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow)
|
|
|
542 |
{
|
|
|
543 |
PetscErrorCode ierr;
|
|
|
544 |
|
|
|
545 |
PetscFunctionBegin;
|
|
|
546 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
|
|
547 |
PetscValidLogicalCollectiveInt(eps,pwindow,2);
|
|
|
548 |
PetscValidLogicalCollectiveInt(eps,qwindow,3);
|
|
|
549 |
ierr = PetscTryMethod(eps,"EPSGDSetWindowSizes_C",(EPS,PetscInt,PetscInt),(eps,pwindow,qwindow));CHKERRQ(ierr);
|
|
|
550 |
PetscFunctionReturn(0);
|
|
|
551 |
}
|