Subversion Repositories slepc-dev

Rev

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

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