Actual source code: davidson.h

  1: /*
  2:   Method: General Davidson Method (includes GD and JD)

  4:   References:
  5:     - Ernest R. Davidson. Super-matrix methods. Computer Physics Communications,
  6:       53:49–60, May 1989.

  8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 10:    Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain

 12:    This file is part of SLEPc.
 13:       
 14:    SLEPc is free software: you can redistribute it and/or modify it under  the
 15:    terms of version 3 of the GNU Lesser General Public License as published by
 16:    the Free Software Foundation.

 18:    SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY 
 19:    WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS 
 20:    FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for 
 21:    more details.

 23:    You  should have received a copy of the GNU Lesser General  Public  License
 24:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 25:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 26: */


 29: /* 
 30:    Dashboard struct: contains the methods that will be employed and the tunning
 31:    options.
 32: */

 34: #include <private/epsimpl.h>         /*I "slepceps.h" I*/
 35: #include <private/stimpl.h>          /*I "slepcst.h" I*/
 36: #include <slepcblaslapack.h>

 38: typedef struct _dvdFunctionList {
 39:   PetscErrorCode (*f)(void*);
 40:   void *d;
 41:   struct _dvdFunctionList *next;
 42: } dvdFunctionList;

 44: typedef PetscInt MatType_t;
 45: #define DVD_MAT_HERMITIAN (1<<1)
 46: #define DVD_MAT_NEG_DEF (1<<2)
 47: #define DVD_MAT_POS_DEF (1<<3)
 48: #define DVD_MAT_SINGULAR (1<<4)
 49: #define DVD_MAT_COMPLEX (1<<5)
 50: #define DVD_MAT_IMPLICIT (1<<6)
 51: #define DVD_MAT_IDENTITY (1<<7)
 52: #define DVD_MAT_DIAG (1<<8)
 53: #define DVD_MAT_TRIANG (1<<9)
 54: #define DVD_MAT_UTRIANG (1<<9)
 55: #define DVD_MAT_LTRIANG (1<<10)
 56: #define DVD_MAT_UNITARY (1<<11)

 58: typedef PetscInt EPType_t;
 59: #define DVD_EP_STD (1<<1)
 60: #define DVD_EP_HERMITIAN (1<<2)

 62: #define DVD_IS(T,P) ((T) & (P))
 63: #define DVD_ISNOT(T,P) (((T) & (P)) ^ (P))

 65: typedef enum {
 66:   DVD_HARM_NONE,
 67:   DVD_HARM_RR,
 68:   DVD_HARM_RRR,
 69:   DVD_HARM_REIGS,
 70:   DVD_HARM_LEIGS
 71: } HarmType_t;

 73: typedef enum {
 74:   DVD_INITV_CLASSIC,
 75:   DVD_INITV_KRYLOV
 76: } InitType_t;

 78: typedef enum {
 79:   DVD_PROJ_KXX,
 80:   DVD_PROJ_KZX
 81: } ProjType_t;

 83: typedef enum {
 84:     DVD_ORTHOV_I,        /* V is orthonormalized */
 85:     DVD_ORTHOV_B,        /* V is B-orthonormalized */
 86:     DVD_ORTHOV_BOneMV    /* V is B-orthonormalized using IPBOrthogonalize */
 87: } orthoV_type_t;


 90: typedef struct _dvdDashboard {
 91:   /**** Function steps ****/
 92:   /* Initialize V */
 93:   PetscErrorCode (*initV)(struct _dvdDashboard*);
 94:   void *initV_data;
 95: 
 96:   /* Find the approximate eigenpairs from V */
 97:   PetscErrorCode (*calcPairs)(struct _dvdDashboard*);
 98:   void *calcPairs_data;

100:   /* Eigenpair test for convergence */
101:   PetscBool (*testConv)(struct _dvdDashboard*, PetscScalar eigvr,
102:        PetscScalar eigvi, PetscReal res, PetscReal *error);
103:   void *testConv_data;

105:   /* Number of converged eigenpairs */
106:   PetscInt nconv;

108:   /* Number of pairs ready to converge */
109:   PetscInt npreconv;

111:   /* Improve the selected eigenpairs */
112:   PetscErrorCode (*improveX)(struct _dvdDashboard*, Vec *D, PetscInt max_size_D,
113:                        PetscInt r_s, PetscInt r_e, PetscInt *size_D);
114:   void *improveX_data;

116:   /* Check for restarting */
117:   PetscBool (*isRestarting)(struct _dvdDashboard*);
118:   void *isRestarting_data;

120:   /* Perform restarting */
121:   PetscErrorCode (*restartV)(struct _dvdDashboard*);
122:   void *restartV_data;

124:   /* Update V */
125:   PetscErrorCode (*updateV)(struct _dvdDashboard*);
126:   void *updateV_data;

128:   /**** Problem specification ****/
129:   Mat A, B;         /* Problem matrices */
130:   MatType_t sA, sB; /* Matrix specifications */
131:   EPType_t sEP;     /* Problem specifications */
132:   PetscInt nev;     /* number of eigenpairs */
133:   EPSWhich which;   /* spectrum selection */
134:   PetscBool
135:     withTarget;     /* if there is a target */
136:   PetscScalar
137:     target[2];         /* target value */
138:   PetscReal tol;    /* tolerance */
139:   PetscBool
140:     correctXnorm;   /* if true, norm of X are computed */

142:   /**** Subspaces specification ****/
143:   Vec *V,           /* searching subspace */
144:     *real_V,        /* original V */
145:     *W,             /* testing subspace */
146:     *real_W,        /* original W */
147:     *cX,            /* converged right eigenvectors */
148:     *cY,            /* converged left eigenvectors */
149:     *BcX,           /* basis of B*cX */
150:     *AV,            /* A*V */
151:     *real_AV,       /* original A*V space */
152:     *BV,            /* B*V */
153:     *real_BV,       /* original B*V space */
154:     *BDS;           /* B * eps->DV */
155:   PetscInt size_V,  /* size of V */
156:     size_real_V,    /* original size of V */
157:     size_W,         /* size of W */
158:     size_real_W,    /* original size of W */
159:     size_AV,        /* size of AV */
160:     size_real_AV,   /* original size of AV */
161:     size_BV,        /* size of BV */
162:     size_BDS,       /* size of BDS */
163:     size_real_BV,   /* original size of BV */
164:     size_cX,        /* size of cX */
165:     size_cY,        /* size of cY */
166:     size_D,         /* active vectors */
167:     size_BcX,       /* size of BcX */
168:     size_real_eigr, /* size of original eigr, eigi, nR, errest */
169:     max_size_V,     /* max size of V */
170:     max_size_W,     /* max size of W */
171:     max_size_X,     /* max new vectors in V */
172:     max_size_AV,    /* max size of AV */
173:     max_size_BV,    /* max size of BV */
174:     max_size_proj,  /* max size projected problem */
175:     max_cX_in_proj, /* max vectors from cX in the projected problem */
176:     max_cX_in_impr, /* max vectros from cX in the projector */
177:     max_size_P,     /* max unconverged vectors in the projector */
178:     bs;             /* max vectors that expands the subspace every iteration */
179:   EPS eps;          /* Connection to SLEPc */
180: 
181:   /**** Auxiliary space ****/
182:   Vec *auxV;        /* auxiliary vectors */
183:   PetscScalar
184:     *auxS;          /* auxiliary scalars */
185:   PetscInt
186:     size_auxV,      /* max size of auxV */
187:     size_auxS;      /* max size of auxS */

189:   /**** Eigenvalues and errors ****/
190:   PetscScalar
191:     *ceigr, *ceigi, /* converged eigenvalues */
192:     *eigr, *eigi,   /* current eigenvalues */
193:     *real_eigr,
194:     *real_eigi;     /* original eigr and eigi */
195:   PetscReal
196:     *nR,            /* residual norm */
197:     *real_nR,       /* original nR */
198:     *nX,            /* X norm */
199:     *real_nX,       /* original nX */
200:     *errest,        /* relative error eigenpairs */
201:     *real_errest;   /* original errest */

203:   /**** Shared function and variables ****/
204:   PetscErrorCode (*e_Vchanged)(struct _dvdDashboard*, PetscInt s_imm,
205:                          PetscInt e_imm, PetscInt s_new, PetscInt e_new);
206:   void *e_Vchanged_data;

208:   PetscErrorCode (*calcpairs_residual)(struct _dvdDashboard*, PetscInt s, PetscInt e,
209:                                  Vec *R);
210:   PetscErrorCode (*calcpairs_selectPairs)(struct _dvdDashboard*, PetscInt n);
211:   void *calcpairs_residual_data;
212:   PetscErrorCode (*improvex_precond)(struct _dvdDashboard*, PetscInt i, Vec x,
213:                   Vec Px);
214:   void *improvex_precond_data;
215:   PetscErrorCode (*improvex_jd_proj_uv)(struct _dvdDashboard*, PetscInt i_s,
216:                                         PetscInt i_e, Vec *u, Vec *v,
217:                                         Vec *kr, Vec *auxV,
218:                                         PetscScalar *theta,
219:                                         PetscScalar *thetai,
220:                                         PetscScalar *pX, PetscScalar *pY,
221:                                         PetscInt ld);
222:   PetscErrorCode (*improvex_jd_lit)(struct _dvdDashboard*, PetscInt i,
223:                                     PetscScalar* theta, PetscScalar* thetai,
224:                                     PetscInt *maxits, PetscReal *tol);
225:   PetscErrorCode (*calcpairs_W)(struct _dvdDashboard*);
226:   void *calcpairs_W_data;
227:   PetscErrorCode (*calcpairs_proj_trans)(struct _dvdDashboard*);
228:   PetscErrorCode (*calcpairs_eigs_trans)(struct _dvdDashboard*);
229:   PetscErrorCode (*calcpairs_proj_res)(struct _dvdDashboard*, PetscInt r_s,
230:                   PetscInt r_e, Vec *R);
231:   PetscErrorCode (*preTestConv)(struct _dvdDashboard*, PetscInt s, PetscInt pre,
232:                                 PetscInt e, Vec *auxV, PetscScalar *auxS,
233:                                       PetscInt *nConv);

235:   PetscErrorCode (*e_newIteration)(struct _dvdDashboard*);
236:   void *e_newIteration_data;

238:   IP ipI;
239:   IP ipV,           /* orthogonal routine options for V subspace */
240:     ipW;            /* orthogonal routine options for W subspace */

242:   dvdFunctionList
243:     *startList,     /* starting list */
244:     *endList,       /* ending list */
245:     *destroyList;   /* destructor list */

247:   PetscScalar *H,   /* Projected problem matrix A*/
248:     *real_H,        /* original H */
249:     *G,             /* Projected problem matrix B*/
250:     *real_G,        /* original G */
251:     *pX,            /* projected problem right eigenvectors */
252:     *pY,            /* projected problem left eigenvectors */
253:     *MTX,           /* right transformation matrix */
254:     *MTY,           /* left transformation matrix */
255:     *S,             /* first Schur matrix, S = pY'*H*pX */
256:     *T,             /* second Schur matrix, T = pY'*G*pX */
257:     *cS,            /* first Schur matrix of converged pairs */
258:     *cT;            /* second Schur matrix of converged pairs */
259:   MatType_t
260:     sH,             /* H properties */
261:     sG;             /* G properties */
262:   PetscInt ldH,     /* leading dimension of H */
263:     ldpX,           /* leading dimension of pX */
264:     ldpY,           /* leading dimension of pY */
265:     ldMTX,          /* leading dimension of MTX */
266:     ldMTY,          /* leading dimension of MTY */
267:     ldS,            /* leading dimension of S */
268:     ldT,            /* leading dimension of T */
269:     ldcS,           /* leading dimension of cS */
270:     ldcT,           /* leading dimension of cT */
271:     size_H,         /* rows and columns in H */
272:     size_G,         /* rows and columns in G */
273:     size_MT,        /* rows in MT */
274:     size_cS,        /* dimension of cS */
275:     size_cT,        /* dimension of cT */
276:     max_size_cS,    /* max size of cS and cT */
277:     cX_in_V,        /* number of converged vectors in V */
278:     cX_in_W,        /* number of converged vectors in W */
279:     cX_in_AV,       /* number of converged vectors in AV */
280:     cX_in_BV,       /* number of converged vectors in BV */
281:     cX_in_H,        /* number of converged vectors in H */
282:     cX_in_G;        /* number of converged vectors in G */

284:   PetscInt
285:     V_tra_s,
286:     V_tra_e,        /* cX <- [cX V*MT(0:V_tra_s-1)], V <- V*MT(V_tra_s:V_tra_e) */
287:     V_new_s,
288:     V_new_e;        /* added to V the columns V_new_s:V_new_e */
289:   PetscBool
290:     BV_shift,       /* if true BV is shifted when vectors converge */
291:     W_shift;        /* if true W is shifted when vectors converge */

293:   orthoV_type_t orthoV_type;

295:   void* prof_data;  /* profiler data */
296: } dvdDashboard;

298: /* Add the function fun at the beginning of list */
299: #define DVD_FL_ADD_BEGIN(list, fun) { \
300:   dvdFunctionList *fl=(list); \
302:   PetscMalloc(sizeof(dvdFunctionList), &(list));  \
303:   (list)->f = (PetscErrorCode(*)(void*))(fun); \
304:   (list)->next = fl; }

306: /* Add the function fun at the end of list */
307: #define DVD_FL_ADD_END(list, fun) { \
308:   if ((list)) {DVD_FL_ADD_END0(list, fun);} \
309:   else {DVD_FL_ADD_BEGIN(list, fun);} }

311: #define DVD_FL_ADD_END0(list, fun) { \
312:   dvdFunctionList *fl=(list); \
314:   for(;fl->next; fl = fl->next); \
315:   PetscMalloc(sizeof(dvdFunctionList), &fl->next);  \
316:   fl->next->f = (PetscErrorCode(*)(void*))(fun); \
317:   fl->next->next = PETSC_NULL; }

319: #define DVD_FL_ADD(list, fun) DVD_FL_ADD_END(list, fun)

321: #define DVD_FL_CALL(list, arg0) { \
322:   dvdFunctionList *fl; \
323:   for(fl=(list); fl; fl=fl->next) \
324:     if(*(dvdCallback)fl->f) (*(dvdCallback)fl->f)((arg0)); }

326: #define DVD_FL_DEL(list) { \
327:   dvdFunctionList *fl=(list), *oldfl; \
329:   while(fl) { \
330:     oldfl = fl; fl = fl->next; PetscFree(oldfl);  } \
331:   (list) = PETSC_NULL;}

333: /*
334:   The blackboard configuration structure: saves information about the memory
335:   and other requirements.

337:   The starting memory structure:

339:   V           W?          AV          BV?          tKZ     
340:   |-----------|-----------|-----------|------------|-------|
341:   nev+mpd     nev+mpd     scP+mpd     nev?+mpd     sP+scP  
342:               scP+mpd                 scP+mpd

344:   The final memory structure considering W_shift and BV_shift:

346:   cX  V       cY?  W?     cAV AV      BcX? BV?     KZ  tKZ 
347:   |---|-------|----|------|---|-------|----|-------|---|---|
348:   nev mpd     nev  mpd    scP mpd     nev  mpd     scP sP    <- shift
349:               scP                     scP                    <- !shift
350: */
351: typedef struct {
352:   PetscInt max_size_V,  /* max size of the searching subspace (mpd) */
353:     max_size_X,         /* max size of X (bs) */
354:     size_V,             /* real size of V (nev+size_P+mpd) */
355:     max_size_oldX,      /* max size of oldX */
356:     max_size_auxV,      /* max size of auxiliary vecs */
357:     max_size_auxS,      /* max size of auxiliary scalars */
358:     max_nev,            /* max number of converged pairs */
359:     max_size_P,         /* number of computed vectors for the projector */
360:     max_size_cP,        /* number of converged vectors in the projectors */
361:     max_size_proj,      /* max size projected problem */
362:     own_vecs,           /* number of global vecs */
363:     own_scalars;        /* number of local scalars */
364:   Vec *free_vecs;       /* free global vectors */
365:   PetscScalar
366:     *free_scalars;      /* free scalars */
367:   PetscInt state;       /* method states:
368:                             0: preconfiguring
369:                             1: configuring
370:                             2: running
371:                         */
372: } dvdBlackboard;

374: #define DVD_STATE_PRECONF 0
375: #define DVD_STATE_CONF 1
376: #define DVD_STATE_RUN 2

378: /* Shared types */
379: typedef PetscErrorCode (*dvdPrecond)(dvdDashboard*, PetscInt i, Vec x, Vec Px);
380: typedef PetscErrorCode (*dvdCallback)(dvdDashboard*);
381: typedef PetscErrorCode (*e_Vchanged_type)(dvdDashboard*, PetscInt s_imm,
382:                          PetscInt e_imm, PetscInt s_new, PetscInt e_new);
383: typedef PetscBool (*isRestarting_type)(dvdDashboard*);
384: typedef PetscErrorCode (*e_newIteration_type)(dvdDashboard*);
385: typedef PetscErrorCode (*improveX_type)(dvdDashboard*, Vec *D, PetscInt max_size_D,
386:                                   PetscInt r_s, PetscInt r_e, PetscInt *size_D);

388: /* Structures for blas */
389: typedef PetscErrorCode (*DvdReductionPostF)(PetscScalar*,PetscInt,void*);
390: typedef struct {
391:   PetscScalar
392:     *out;               /* final vector */
393:   PetscInt
394:     size_out;           /* size of out */
395:   DvdReductionPostF
396:     f;                  /* function called after the reduction */
397:   void *ptr;
398: } DvdReductionChunk;

400: typedef struct {
401:   PetscScalar
402:     *in,                /* vector to sum-up with more nodes */
403:     *out;               /* final vector */
404:   PetscInt size_in,     /* size of in */
405:     max_size_in;        /* max size of in */
406:   DvdReductionChunk
407:     *ops;               /* vector of reduction operations */
408:   PetscInt
409:     size_ops,           /* size of ops */
410:     max_size_ops;       /* max size of ops */
411:   MPI_Comm comm;        /* MPI communicator */
412: } DvdReduction;

414: typedef struct {
415:   PetscInt i0, i1, i2, ld, s0, e0, s1, e1;
416:   PetscScalar *M;
417: } DvdMult_copy_func;

419: /* Routines for initV step */
420: PetscErrorCode dvd_initV(dvdDashboard *d, dvdBlackboard *b, PetscInt k,
421:                          PetscInt user, PetscBool krylov);

423: /* Routines for calcPairs step */
424: PetscErrorCode dvd_calcpairs_qz(dvdDashboard *d, dvdBlackboard *b,
425:                                 orthoV_type_t orth, IP ipI,
426:                                 PetscInt cX_proj, PetscBool harm);

428: /* Routines for improveX step */
429: PetscErrorCode dvd_improvex_jd(dvdDashboard *d, dvdBlackboard *b, KSP ksp,
430:                          PetscInt max_bs, PetscInt cX_impr, PetscBool dynamic);
431: PetscErrorCode dvd_improvex_jd_proj_uv(dvdDashboard *d, dvdBlackboard *b,
432:                                  ProjType_t p);
433: PetscErrorCode dvd_improvex_jd_lit_const(dvdDashboard *d, dvdBlackboard *b,
434:                                    PetscInt maxits, PetscReal tol,
435:                                    PetscReal fix);

437: /* Routines for testConv step */
438: PetscErrorCode dvd_testconv_basic(dvdDashboard *d, dvdBlackboard *b);
439: PetscErrorCode dvd_testconv_slepc(dvdDashboard *d, dvdBlackboard *b);

441: /* Routines for management of V */
442: PetscErrorCode dvd_managementV_basic(dvdDashboard *d, dvdBlackboard *b,
443:                                      PetscInt bs, PetscInt mpd,
444:                                      PetscInt min_size_V,
445:                                      PetscInt plusk, PetscBool harm,
446:                                      PetscBool allResiduals);

448: /* Some utilities */
449: PetscErrorCode dvd_static_precond_PC(dvdDashboard *d, dvdBlackboard *b, PC pc);
450: PetscErrorCode dvd_jacobi_precond(dvdDashboard *d, dvdBlackboard *b);
451: PetscErrorCode dvd_profiler(dvdDashboard *d, dvdBlackboard *b);
452: PetscErrorCode dvd_prof_init();
453: PetscErrorCode dvd_harm_conf(dvdDashboard *d, dvdBlackboard *b,
454:                              HarmType_t mode, PetscBool fixedTarget,
455:                              PetscScalar t);

457: /* Methods */
458: PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d, dvdBlackboard *b,
459:   PetscInt mpd, PetscInt min_size_V, PetscInt bs,
460:   PetscInt ini_size_V, PetscInt size_initV, PetscInt plusk,
461:   HarmType_t harmMode, KSP ksp, InitType_t init, PetscBool allResiduals,
462:   orthoV_type_t orth, PetscInt cX_proj, PetscInt cX_impr);
463: PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d, dvdBlackboard *b,
464:   PetscInt mpd, PetscInt min_size_V, PetscInt bs,
465:   PetscInt ini_size_V, PetscInt size_initV, PetscInt plusk,
466:   IP ip, HarmType_t harmMode, PetscBool fixedTarget, PetscScalar t, KSP ksp,
467:   PetscReal fix, InitType_t init, PetscBool allResiduals, orthoV_type_t orth,
468:   PetscInt cX_proj, PetscInt cX_impr, PetscBool dynamic);

470: /* BLAS routines */
471: PetscErrorCode SlepcDenseMatProd(PetscScalar *C, PetscInt _ldC, PetscScalar b,
472:   PetscScalar a,
473:   const PetscScalar *A, PetscInt _ldA, PetscInt rA, PetscInt cA, PetscBool At,
474:   const PetscScalar *B, PetscInt _ldB, PetscInt rB, PetscInt cB, PetscBool Bt);
475: PetscErrorCode SlepcDenseMatProdTriang(
476:   PetscScalar *C, MatType_t sC, PetscInt ldC,
477:   const PetscScalar *A, MatType_t sA, PetscInt ldA, PetscInt rA, PetscInt cA,
478:   PetscBool At,
479:   const PetscScalar *B, MatType_t sB, PetscInt ldB, PetscInt rB, PetscInt cB,
480:   PetscBool Bt);
481: PetscErrorCode SlepcDenseNorm(PetscScalar *A, PetscInt ldA, PetscInt _rA,
482:                               PetscInt cA, PetscScalar *eigi);
483: PetscErrorCode SlepcDenseOrth(PetscScalar *A, PetscInt _ldA, PetscInt _rA,
484:                               PetscInt _cA, PetscScalar *auxS, PetscInt _lauxS,
485:                               PetscInt *ncA);
486: PetscErrorCode SlepcDenseCopy(PetscScalar *Y, PetscInt ldY, PetscScalar *X,
487:                               PetscInt ldX, PetscInt rX, PetscInt cX);
488: PetscErrorCode SlepcDenseCopyTriang(PetscScalar *Y, MatType_t sY, PetscInt ldY,
489:                                     PetscScalar *X, MatType_t sX, PetscInt ldX,
490:                                     PetscInt rX, PetscInt cX);
491: PetscErrorCode SlepcUpdateVectorsZ(Vec *Y, PetscScalar beta, PetscScalar alpha,
492:   Vec *X, PetscInt cX, const PetscScalar *M, PetscInt ldM, PetscInt rM,
493:   PetscInt cM);
494: PetscErrorCode SlepcUpdateVectorsS(Vec *Y, PetscInt dY, PetscScalar beta,
495:   PetscScalar alpha, Vec *X, PetscInt cX, PetscInt dX, const PetscScalar *M,
496:   PetscInt ldM, PetscInt rM, PetscInt cM);
497: PetscErrorCode SlepcUpdateVectorsD(Vec *X, PetscInt cX, PetscScalar alpha,
498:   const PetscScalar *M, PetscInt ldM, PetscInt rM, PetscInt cM,
499:   PetscScalar *work, PetscInt lwork);
500: PetscErrorCode VecsMult(PetscScalar *M, MatType_t sM, PetscInt ldM,
501:                         Vec *U, PetscInt sU, PetscInt eU,
502:                         Vec *V, PetscInt sV, PetscInt eV,
503:                         PetscScalar *workS0, PetscScalar *workS1);
504: PetscErrorCode VecsMultS(PetscScalar *M, MatType_t sM, PetscInt ldM,
505:                          Vec *U, PetscInt sU, PetscInt eU,
506:                          Vec *V, PetscInt sV, PetscInt eV, DvdReduction *r,
507:                          DvdMult_copy_func *sr);
508: PetscErrorCode VecsMultIb(PetscScalar *M, MatType_t sM, PetscInt ldM,
509:                           PetscInt rM, PetscInt cM, PetscScalar *auxS,
510:                           Vec V);
511: PetscErrorCode VecsMultIa(PetscScalar *M, MatType_t sM, PetscInt ldM,
512:                           Vec *U, PetscInt sU, PetscInt eU,
513:                           Vec *V, PetscInt sV, PetscInt eV);
514: PetscErrorCode SlepcAllReduceSumBegin(DvdReductionChunk *ops,
515:                                       PetscInt max_size_ops,
516:                                       PetscScalar *in, PetscScalar *out,
517:                                       PetscInt max_size_in, DvdReduction *r,
518:                                       MPI_Comm comm);
519: PetscErrorCode SlepcAllReduceSum(DvdReduction *r, PetscInt size_in,
520:                                  DvdReductionPostF f, void *ptr,
521:                                  PetscScalar **in);
522: PetscErrorCode SlepcAllReduceSumEnd(DvdReduction *r);
523: PetscErrorCode dvd_orthV(IP ip, Vec *DS, PetscInt size_DS, Vec *cX,
524:                          PetscInt size_cX, Vec *V, PetscInt V_new_s,
525:                          PetscInt V_new_e, PetscScalar *auxS,
526:                          PetscRandom rand);
527: PetscErrorCode dvd_BorthV(IP ip, Vec *DS, Vec *BDS, PetscInt size_DS, Vec *cX,
528:                          Vec *BcX, PetscInt size_cX, Vec *V, Vec *BV,
529:                          PetscInt V_new_s, PetscInt V_new_e,
530:                          PetscScalar *auxS, PetscRandom rand);
531: PetscErrorCode dvd_compute_eigenvectors(PetscInt n_, PetscScalar *S,
532:   PetscInt ldS_, PetscScalar *T, PetscInt ldT_, PetscScalar *pX,
533:   PetscInt ldpX_, PetscScalar *pY, PetscInt ldpY_, PetscScalar *auxS,
534:   PetscInt size_auxS, PetscBool doProd);
536: PetscErrorCode EPSSortDenseHEP(EPS eps, PetscInt n, PetscInt k, PetscScalar *w, PetscScalar *V, PetscInt ldV);

539: /* SLEPc interface routines */
540: PetscErrorCode SLEPcNotImplemented();
541: PetscErrorCode EPSCreate_Davidson(EPS eps);
542: PetscErrorCode EPSReset_Davidson(EPS eps);
543: PetscErrorCode EPSSetUp_Davidson(EPS eps);
544: PetscErrorCode EPSSolve_Davidson(EPS eps);
545: PetscErrorCode EPSComputeVectors_Davidson(EPS eps);
546: PetscErrorCode EPSDavidsonSetKrylovStart_Davidson(EPS eps,PetscBool krylovstart);
547: PetscErrorCode EPSDavidsonGetKrylovStart_Davidson(EPS eps,PetscBool *krylovstart);
548: PetscErrorCode EPSDavidsonSetBlockSize_Davidson(EPS eps,PetscInt blocksize);
549: PetscErrorCode EPSDavidsonGetBlockSize_Davidson(EPS eps,PetscInt *blocksize);
550: PetscErrorCode EPSDavidsonSetRestart_Davidson(EPS eps,PetscInt minv,PetscInt plusk);
551: PetscErrorCode EPSDavidsonGetRestart_Davidson(EPS eps,PetscInt *minv,PetscInt *plusk);
552: PetscErrorCode EPSDavidsonGetInitialSize_Davidson(EPS eps,PetscInt *initialsize);
553: PetscErrorCode EPSDavidsonSetInitialSize_Davidson(EPS eps,PetscInt initialsize);
554: PetscErrorCode EPSDavidsonGetFix_Davidson(EPS eps,PetscReal *fix);
555: PetscErrorCode EPSDavidsonSetFix_Davidson(EPS eps,PetscReal fix);
556: PetscErrorCode EPSDavidsonSetBOrth_Davidson(EPS eps,PetscBool borth);
557: PetscErrorCode EPSDavidsonGetBOrth_Davidson(EPS eps,PetscBool *borth);
558: PetscErrorCode EPSDavidsonSetConstantCorrectionTolerance_Davidson(EPS eps,PetscBool constant);
559: PetscErrorCode EPSDavidsonGetConstantCorrectionTolerance_Davidson(EPS eps,PetscBool *constant);
560: PetscErrorCode EPSDavidsonSetWindowSizes_Davidson(EPS eps,PetscInt pwindow,PetscInt qwindow);
561: PetscErrorCode EPSDavidsonGetWindowSizes_Davidson(EPS eps,PetscInt *pwindow,PetscInt *qwindow);