Subversion Repositories slepc-dev

Rev

Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1619 slepc 1
/*
2110 jroman 2
  Method: General Davidson Method (includes GD and JD)
1619 slepc 3
 
4
  References:
5
    - Ernest R. Davidson. Super-matrix methods. Computer Physics Communications,
6
      53:49–60, May 1989.
7
 
2110 jroman 8
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9
   SLEPc - Scalable Library for Eigenvalue Problem Computations
2116 eromero 10
   Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
1619 slepc 11
 
2110 jroman 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.
1619 slepc 17
 
2110 jroman 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.
1619 slepc 22
 
2110 jroman 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
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1619 slepc 26
*/
27
 
28
 
29
/*
30
   Dashboard struct: contains the methods that will be employed and the tunning
31
   options.
32
*/
33
 
2283 jroman 34
#include <private/epsimpl.h>         /*I "slepceps.h" I*/
35
#include <private/stimpl.h>          /*I "slepcst.h" I*/
36
#include <slepcblaslapack.h>
1619 slepc 37
 
38
typedef struct _dvdFunctionList {
2021 eromero 39
  PetscErrorCode (*f)(void*);
1619 slepc 40
  void *d;
41
  struct _dvdFunctionList *next;
42
} dvdFunctionList;
1735 eromero 43
 
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)
1747 eromero 54
#define DVD_MAT_UTRIANG (1<<9)
55
#define DVD_MAT_LTRIANG (1<<10)
56
#define DVD_MAT_UNITARY (1<<11)
57
 
1756 eromero 58
typedef PetscInt EPType_t;
1960 eromero 59
#define DVD_EP_STD (1<<1)
1756 eromero 60
#define DVD_EP_HERMITIAN (1<<2)
61
 
62
#define DVD_IS(T,P) ((T) & (P))
63
#define DVD_ISNOT(T,P) (((T) & (P)) ^ (P))
64
 
1883 eromero 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;
1795 eromero 72
 
1883 eromero 73
typedef enum {
74
  DVD_INITV_CLASSIC,
75
  DVD_INITV_KRYLOV
76
} InitType_t;
1795 eromero 77
 
1980 eromero 78
typedef enum {
79
  DVD_PROJ_KBXX,
80
  DVD_PROJ_KBXY,
81
  DVD_PROJ_KBXZ,
82
  DVD_PROJ_KBXZY
83
} ProjType_t;
1883 eromero 84
 
2012 eromero 85
typedef enum {
86
    DVD_MT_IDENTITY,/* without transformation */
87
    DVD_MT_pX,       /* using the projected problem eigenvectors */
88
    DVD_MT_ORTHO    /* using an orthonormal transformation */
89
} MT_type_t;
90
 
91
typedef enum {
92
    DVD_ORTHOV_NONE,/* V isn't orthonormalized */
93
    DVD_ORTHOV_I,   /* V is orthonormalized */    
94
    DVD_ORTHOV_B    /* V is B-orthonormalized */
95
} orthoV_type_t;
96
 
97
 
1619 slepc 98
typedef struct _dvdDashboard {
99
  /**** Function steps ****/
100
  /* Initialize V */
2021 eromero 101
  PetscErrorCode (*initV)(struct _dvdDashboard*);
1619 slepc 102
  void *initV_data;
103
 
104
  /* Find the approximate eigenpairs from V */
2021 eromero 105
  PetscErrorCode (*calcPairs)(struct _dvdDashboard*);
1619 slepc 106
  void *calcPairs_data;
107
 
2018 eromero 108
  /* Eigenpair test for convergence */
2216 jroman 109
  PetscBool (*testConv)(struct _dvdDashboard*, PetscScalar eigvr,
1960 eromero 110
       PetscScalar eigvi, PetscReal res, PetscReal *error);
1619 slepc 111
  void *testConv_data;
112
 
113
  /* Number of converged eigenpairs */
114
  PetscInt nconv;
115
 
1735 eromero 116
  /* Number of pairs ready to converge */
117
  PetscInt npreconv;
118
 
1619 slepc 119
  /* Improve the selected eigenpairs */
2021 eromero 120
  PetscErrorCode (*improveX)(struct _dvdDashboard*, Vec *D, PetscInt max_size_D,
1735 eromero 121
                       PetscInt r_s, PetscInt r_e, PetscInt *size_D);
1619 slepc 122
  void *improveX_data;
123
 
124
  /* Check for restarting */
2216 jroman 125
  PetscBool (*isRestarting)(struct _dvdDashboard*);
1619 slepc 126
  void *isRestarting_data;
127
 
128
  /* Perform restarting */
2021 eromero 129
  PetscErrorCode (*restartV)(struct _dvdDashboard*);
1619 slepc 130
  void *restartV_data;
131
 
132
  /* Update V */
2021 eromero 133
  PetscErrorCode (*updateV)(struct _dvdDashboard*);
1619 slepc 134
  void *updateV_data;
135
 
136
  /**** Problem specification ****/
137
  Mat A, B;         /* Problem matrices */
1747 eromero 138
  MatType_t sA, sB; /* Matrix specifications */
1756 eromero 139
  EPType_t sEP;     /* Problem specifications */
1619 slepc 140
  PetscInt nev;     /* number of eigenpairs */
141
  EPSWhich which;   /* spectrum selection */
2216 jroman 142
  PetscBool
1619 slepc 143
    withTarget;     /* if there is a target */
144
  PetscScalar
1883 eromero 145
    target[2];         /* target value */
1619 slepc 146
  PetscReal tol;    /* tolerance */
2216 jroman 147
  PetscBool
2555 eromero 148
    correctXnorm,   /* if true, norm of X are computed */
149
    ipV_oneMV;      /* if true, it uses IPBOrthonormalize */
1619 slepc 150
 
151
  /**** Subspaces specification ****/
152
  Vec *V,           /* searching subspace */
1795 eromero 153
    *W,             /* testing subspace */
1751 eromero 154
    *cX,            /* converged right eigenvectors */
155
    *cY,            /* converged left eigenvectors */
1829 eromero 156
    *BcX,           /* basis of B*cX */
1735 eromero 157
    *AV,            /* A*V */
158
    *real_AV,       /* original A*V space */
159
    *BV,            /* B*V */
2555 eromero 160
    *real_BV,       /* original B*V space */
161
    *BDS;           /* B * eps->DV */
1619 slepc 162
  PetscInt size_V,  /* size of V */
1735 eromero 163
    size_AV,        /* size of AV */
164
    size_BV,        /* size of BV */
1619 slepc 165
    size_cX,        /* size of cX */
1751 eromero 166
    size_cY,        /* size of cY */
1735 eromero 167
    size_D,         /* active vectors */
1619 slepc 168
    max_size_V,     /* max size of V */
169
    max_size_X,     /* max size of X */
1735 eromero 170
    max_size_AV,    /* max size of AV */
2555 eromero 171
    max_size_BV,    /* max size of BV */
172
    max_size_proj;  /* max size projected problem */
1805 eromero 173
  EPS eps;          /* Connection to SLEPc */
1619 slepc 174
 
175
  /**** Auxiliary space ****/
176
  Vec *auxV;        /* auxiliary vectors */
177
  PetscScalar
178
    *auxS;          /* auxiliary scalars */
179
  PetscInt
180
    size_auxV,      /* max size of auxV */
181
    size_auxS;      /* max size of auxS */
182
 
183
  /**** Eigenvalues and errors ****/
184
  PetscScalar
185
    *ceigr, *ceigi, /* converged eigenvalues */
186
    *eigr, *eigi;   /* current eigenvalues */
187
  PetscReal
1735 eromero 188
    *nR,            /* residual norm */
1764 eromero 189
    *nX,            /* X norm */
1735 eromero 190
    *errest;        /* relative error eigenpairs */
1619 slepc 191
 
192
  /**** Shared function and variables ****/
2021 eromero 193
  PetscErrorCode (*e_Vchanged)(struct _dvdDashboard*, PetscInt s_imm,
1619 slepc 194
                         PetscInt e_imm, PetscInt s_new, PetscInt e_new);
195
  void *e_Vchanged_data;
196
 
2021 eromero 197
  PetscErrorCode (*calcpairs_residual)(struct _dvdDashboard*, PetscInt s, PetscInt e,
1751 eromero 198
                                 Vec *R, PetscScalar *auxS, Vec auxV);
2021 eromero 199
  PetscErrorCode (*calcpairs_selectPairs)(struct _dvdDashboard*, PetscInt n);
1736 eromero 200
  void *calcpairs_residual_data;
2021 eromero 201
  PetscErrorCode (*calcpairs_X)(struct _dvdDashboard*, PetscInt s, PetscInt e,
1735 eromero 202
                          Vec *X);
2021 eromero 203
  PetscErrorCode (*calcpairs_Y)(struct _dvdDashboard*, PetscInt s, PetscInt e,
1809 eromero 204
                          Vec *Y);
1736 eromero 205
  PetscErrorCode (*improvex_precond)(struct _dvdDashboard*, PetscInt i, Vec x,
206
                  Vec Px);
207
  void *improvex_precond_data;
1960 eromero 208
  PetscErrorCode (*improvex_jd_proj_uv)(struct _dvdDashboard*, PetscInt i_s,
209
                                        PetscInt i_e, Vec **u, Vec **v,
1965 eromero 210
                                        Vec **kr, Vec **auxV_,
211
                                        PetscScalar *theta,
212
                                        PetscScalar *thetai,
213
                                        PetscScalar *pX, PetscScalar *pY,
214
                                        PetscInt ld);
1867 eromero 215
  PetscErrorCode (*improvex_jd_lit)(struct _dvdDashboard*, PetscInt i,
1960 eromero 216
                                    PetscScalar* theta, PetscScalar* thetai,
217
                                    PetscInt *maxits, PetscReal *tol);
1795 eromero 218
  PetscErrorCode (*calcpairs_W)(struct _dvdDashboard*);
219
  void *calcpairs_W_data;
220
  PetscErrorCode (*calcpairs_proj_trans)(struct _dvdDashboard*);
1883 eromero 221
  PetscErrorCode (*calcpairs_eigs_trans)(struct _dvdDashboard*);
222
  PetscErrorCode (*calcpairs_proj_res)(struct _dvdDashboard*, PetscInt r_s,
223
                  PetscInt r_e, Vec *R);
2018 eromero 224
  PetscErrorCode (*preTestConv)(struct _dvdDashboard*, PetscInt s, PetscInt pre,
225
                                PetscInt e, Vec *auxV, PetscScalar *auxS,
226
                                      PetscInt *nConv);
1619 slepc 227
 
2021 eromero 228
  PetscErrorCode (*e_newIteration)(struct _dvdDashboard*);
1619 slepc 229
  void *e_newIteration_data;
230
 
1751 eromero 231
  IP ipI;
1795 eromero 232
  IP ipV,           /* orthogonal routine options for V subspace */
233
    ipW;            /* orthogonal routine options for W subspace */
1751 eromero 234
 
1619 slepc 235
  dvdFunctionList
1883 eromero 236
    *startList,     /* starting list */
237
    *endList,       /* ending list */
1619 slepc 238
    *destroyList;   /* destructor list */
239
 
1735 eromero 240
  PetscScalar *H,   /* Projected problem matrix A*/
241
    *real_H,        /* original H */
242
    *G,             /* Projected problem matrix B*/
243
    *real_G,        /* original G */
1750 eromero 244
    *pX,            /* projected problem right eigenvectors */
245
    *pY,            /* projected problem left eigenvectors */
1795 eromero 246
    *MTX,           /* right transformation matrix */
247
    *MTY,           /* left transformation matrix */
1750 eromero 248
    *S,             /* first Schur matrix, S = pY'*H*pX */
1756 eromero 249
    *T,             /* second Schur matrix, T = pY'*G*pX */
250
    *cS,            /* first Schur matrix of converged pairs */
251
    *cT;            /* second Schur matrix of converged pairs */
1750 eromero 252
  MatType_t
253
    pX_type,        /* pX properties */
254
    pY_type,        /* pY properties */
1747 eromero 255
    sH,             /* H properties */
256
    sG;             /* G properties */
1735 eromero 257
  PetscInt ldH,     /* leading dimension of H */
1750 eromero 258
    ldpX,           /* leading dimension of pX */
259
    ldpY,           /* leading dimension of pY */
1795 eromero 260
    ldMTX,          /* leading dimension of MTX */
261
    ldMTY,          /* leading dimension of MTY */
1750 eromero 262
    ldS,            /* leading dimension of S */
263
    ldT,            /* leading dimension of T */
1756 eromero 264
    ldcS,           /* leading dimension of cS */
265
    ldcT,           /* leading dimension of cT */
1742 eromero 266
    size_H,         /* rows and columns in H */
267
    size_G,         /* rows and columns in G */
2244 eromero 268
    size_MT,        /* rows in MT */
269
    max_size_cS;    /* max size of cS and cT */
1619 slepc 270
 
1735 eromero 271
  PetscInt V_imm_s,
272
    V_imm_e,        /* unchanged V columns, V_imm_s:V_imm_e-1 */
273
    V_tra_s,
274
    V_tra_e,        /* V(V_tra_e:) = V*MT(V_tra_s:V_tra_e-1) */
275
    V_new_s,
276
    V_new_e;        /* added to V the columns V_new_s:V_new_e */
1975 eromero 277
 
2555 eromero 278
  PetscBool
279
   doNotUpdateBV;   /* when true indicates that BV was updated yet */
280
 
2012 eromero 281
  MT_type_t MT_type;
282
  orthoV_type_t orthoV_type;
283
 
1975 eromero 284
  PetscRandom rand; /* random seed */
1992 eromero 285
  void* prof_data;  /* profiler data */
1619 slepc 286
} dvdDashboard;
287
 
2244 eromero 288
/* Add the function fun at the beginning of list */
289
#define DVD_FL_ADD_BEGIN(list, fun) { \
1619 slepc 290
  dvdFunctionList *fl=(list); \
291
  PetscErrorCode ierr; \
292
  ierr = PetscMalloc(sizeof(dvdFunctionList), &(list)); CHKERRQ(ierr); \
2021 eromero 293
  (list)->f = (PetscErrorCode(*)(void*))(fun); \
1619 slepc 294
  (list)->next = fl; }
295
 
2244 eromero 296
/* Add the function fun at the end of list */
297
#define DVD_FL_ADD_END(list, fun) { \
298
  if ((list)) {DVD_FL_ADD_END0(list, fun);} \
299
  else {DVD_FL_ADD_BEGIN(list, fun);} }
300
 
301
#define DVD_FL_ADD_END0(list, fun) { \
302
  dvdFunctionList *fl=(list); \
303
  PetscErrorCode ierr; \
304
  for(;fl->next; fl = fl->next); \
305
  ierr = PetscMalloc(sizeof(dvdFunctionList), &fl->next); CHKERRQ(ierr); \
306
  fl->next->f = (PetscErrorCode(*)(void*))(fun); \
307
  fl->next->next = PETSC_NULL; }
308
 
309
#define DVD_FL_ADD(list, fun) DVD_FL_ADD_END(list, fun)
310
 
1883 eromero 311
#define DVD_FL_CALL(list, arg0) { \
1619 slepc 312
  dvdFunctionList *fl; \
2422 eromero 313
  for(fl=(list); fl; fl=fl->next) \
314
    if(*(dvdCallback)fl->f) (*(dvdCallback)fl->f)((arg0)); }
1619 slepc 315
 
316
#define DVD_FL_DEL(list) { \
317
  dvdFunctionList *fl=(list), *oldfl; \
318
  PetscErrorCode ierr; \
319
  while(fl) { \
2422 eromero 320
    oldfl = fl; fl = fl->next; ierr = PetscFree(oldfl); CHKERRQ(ierr); } \
321
  (list) = PETSC_NULL;}
1619 slepc 322
 
323
/*
324
  The blackboard configuration structure: saves information about the memory
325
  and other requirements
326
*/
327
typedef struct {
2047 eromero 328
  PetscInt max_size_V,  /* max size of the searching subspace */
1619 slepc 329
    max_size_X,         /* max size of X */
2047 eromero 330
    size_V,             /* real size of V */
1619 slepc 331
    max_size_oldX,      /* max size of oldX */
332
    max_size_auxV,      /* max size of auxiliary vecs */
333
    max_size_auxS,      /* max size of auxiliary scalars */
1966 eromero 334
    max_nev,            /* max number of converged pairs */
1619 slepc 335
    own_vecs,           /* number of global vecs */
336
    own_scalars;        /* number of local scalars */
337
  Vec *free_vecs;       /* free global vectors */
338
  PetscScalar
339
    *free_scalars;      /* free scalars */
1734 eromero 340
  PetscInt state;       /* method states:
1619 slepc 341
                            0: preconfiguring
342
                            1: configuring
343
                            2: running
344
                        */
345
} dvdBlackboard;
346
 
1734 eromero 347
#define DVD_STATE_PRECONF 0
348
#define DVD_STATE_CONF 1
349
#define DVD_STATE_RUN 2
1619 slepc 350
 
351
/* Shared types */
1736 eromero 352
typedef void* dvdPrecondData; // DEPRECATED!!
353
typedef PetscErrorCode (*dvdPrecond)(dvdDashboard*, PetscInt i, Vec x, Vec Px);
2021 eromero 354
typedef PetscErrorCode (*dvdCallback)(dvdDashboard*);
355
typedef PetscErrorCode (*e_Vchanged_type)(dvdDashboard*, PetscInt s_imm,
1619 slepc 356
                         PetscInt e_imm, PetscInt s_new, PetscInt e_new);
2216 jroman 357
typedef PetscBool (*isRestarting_type)(dvdDashboard*);
2021 eromero 358
typedef PetscErrorCode (*e_newIteration_type)(dvdDashboard*);
359
typedef PetscErrorCode (*improveX_type)(dvdDashboard*, Vec *D, PetscInt max_size_D,
1735 eromero 360
                                  PetscInt r_s, PetscInt r_e, PetscInt *size_D);
1619 slepc 361
 
1753 eromero 362
/* Structures for blas */
363
typedef PetscErrorCode (*DvdReductionPostF)(PetscScalar*,PetscInt,void*);
364
typedef struct {
365
  PetscScalar
366
    *out;               /* final vector */
367
  PetscInt
368
    size_out;           /* size of out */
369
  DvdReductionPostF
370
    f;                  /* function called after the reduction */
371
  void *ptr;
372
} DvdReductionChunk;  
373
 
374
typedef struct {
375
  PetscScalar
376
    *in,                /* vector to sum-up with more nodes */
377
    *out;               /* final vector */
378
  PetscInt size_in,     /* size of in */
379
    max_size_in;        /* max size of in */
380
  DvdReductionChunk
381
    *ops;               /* vector of reduction operations */
382
  PetscInt
383
    size_ops,           /* size of ops */
384
    max_size_ops;       /* max size of ops */
385
  MPI_Comm comm;        /* MPI communicator */
386
} DvdReduction;
387
 
388
typedef struct {
389
  PetscInt i0, i1, i2, ld, s0, e0, s1, e1;
390
  PetscScalar *M;
391
} DvdMult_copy_func;
392
 
1619 slepc 393
/* Routines for initV step */
2440 eromero 394
PetscErrorCode dvd_initV(dvdDashboard *d, dvdBlackboard *b, PetscInt k,
2441 eromero 395
                         PetscInt user, PetscBool krylov);
1619 slepc 396
 
397
/* Routines for calcPairs step */
2021 eromero 398
PetscErrorCode dvd_calcpairs_rr(dvdDashboard *d, dvdBlackboard *b);
399
PetscErrorCode dvd_calcpairs_qz(dvdDashboard *d, dvdBlackboard *b, IP ip);
1619 slepc 400
 
401
/* Routines for improveX step */
2021 eromero 402
PetscErrorCode dvd_improvex_jd(dvdDashboard *d, dvdBlackboard *b, KSP ksp,
1965 eromero 403
                         PetscInt max_bs);
2021 eromero 404
PetscErrorCode dvd_improvex_jd_proj_uv(dvdDashboard *d, dvdBlackboard *b,
1980 eromero 405
                                 ProjType_t p);
2021 eromero 406
PetscErrorCode dvd_improvex_jd_lit_const(dvdDashboard *d, dvdBlackboard *b,
1883 eromero 407
                                   PetscInt maxits, PetscReal tol,
408
                                   PetscReal fix);
1619 slepc 409
 
410
/* Routines for testConv step */
2021 eromero 411
PetscErrorCode dvd_testconv_basic(dvdDashboard *d, dvdBlackboard *b);
412
PetscErrorCode dvd_testconv_slepc(dvdDashboard *d, dvdBlackboard *b);
1619 slepc 413
 
414
/* Routines for management of V */
2021 eromero 415
PetscErrorCode dvd_managementV_basic(dvdDashboard *d, dvdBlackboard *b,
2023 eromero 416
                                     PetscInt bs, PetscInt max_size_V,
417
                                     PetscInt mpd, PetscInt min_size_V,
2216 jroman 418
                                     PetscInt plusk, PetscBool harm,
419
                                     PetscBool allResiduals);
1619 slepc 420
 
421
/* Some utilities */
1764 eromero 422
PetscErrorCode dvd_static_precond_PC(dvdDashboard *d, dvdBlackboard *b, PC pc);
1736 eromero 423
PetscErrorCode dvd_jacobi_precond(dvdDashboard *d, dvdBlackboard *b);
1992 eromero 424
PetscErrorCode dvd_profiler(dvdDashboard *d, dvdBlackboard *b);
425
PetscErrorCode dvd_prof_init();
1795 eromero 426
PetscErrorCode dvd_harm_conf(dvdDashboard *d, dvdBlackboard *b,
2216 jroman 427
                             HarmType_t mode, PetscBool fixedTarget,
1795 eromero 428
                             PetscScalar t);
1619 slepc 429
 
430
/* Methods */
431
PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d, dvdBlackboard *b,
2023 eromero 432
  PetscInt max_size_V, PetscInt mpd, PetscInt min_size_V, PetscInt bs,
2244 eromero 433
  PetscInt ini_size_V, PetscInt size_initV, PetscInt plusk,
2216 jroman 434
  HarmType_t harmMode, KSP ksp, InitType_t init, PetscBool allResiduals);
1619 slepc 435
PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d, dvdBlackboard *b,
2023 eromero 436
  PetscInt max_size_V, PetscInt mpd, PetscInt min_size_V, PetscInt bs,
2244 eromero 437
  PetscInt ini_size_V, PetscInt size_initV, PetscInt plusk,
2216 jroman 438
  IP ip, HarmType_t harmMode, PetscBool fixedTarget, PetscScalar t, KSP ksp,
439
  PetscReal fix, InitType_t init, PetscBool allResiduals);
1619 slepc 440
 
441
/* BLAS routines */
442
PetscErrorCode SlepcDenseMatProd(PetscScalar *C, PetscInt _ldC, PetscScalar b,
443
  PetscScalar a,
2216 jroman 444
  const PetscScalar *A, PetscInt _ldA, PetscInt rA, PetscInt cA, PetscBool At,
445
  const PetscScalar *B, PetscInt _ldB, PetscInt rB, PetscInt cB, PetscBool Bt);
1747 eromero 446
PetscErrorCode SlepcDenseMatProdTriang(
447
  PetscScalar *C, MatType_t sC, PetscInt ldC,
448
  const PetscScalar *A, MatType_t sA, PetscInt ldA, PetscInt rA, PetscInt cA,
2216 jroman 449
  PetscBool At,
1747 eromero 450
  const PetscScalar *B, MatType_t sB, PetscInt ldB, PetscInt rB, PetscInt cB,
2216 jroman 451
  PetscBool Bt);
1750 eromero 452
PetscErrorCode SlepcDenseNorm(PetscScalar *A, PetscInt ldA, PetscInt _rA,
1965 eromero 453
                              PetscInt cA, PetscScalar *eigi);
1742 eromero 454
PetscErrorCode SlepcDenseOrth(PetscScalar *A, PetscInt _ldA, PetscInt _rA,
455
                              PetscInt _cA, PetscScalar *auxS, PetscInt _lauxS,
456
                              PetscInt *ncA);
457
PetscErrorCode SlepcDenseCopy(PetscScalar *Y, PetscInt ldY, PetscScalar *X,
458
                              PetscInt ldX, PetscInt rX, PetscInt cX);
1752 eromero 459
PetscErrorCode SlepcDenseCopyTriang(PetscScalar *Y, MatType_t sY, PetscInt ldY,
460
                                    PetscScalar *X, MatType_t sX, PetscInt ldX,
461
                                    PetscInt rX, PetscInt cX);
1675 slepc 462
PetscErrorCode SlepcUpdateVectorsZ(Vec *Y, PetscScalar beta, PetscScalar alpha,
463
  Vec *X, PetscInt cX, const PetscScalar *M, PetscInt ldM, PetscInt rM,
464
  PetscInt cM);
1960 eromero 465
PetscErrorCode SlepcUpdateVectorsS(Vec *Y, PetscInt dY, PetscScalar beta,
466
  PetscScalar alpha, Vec *X, PetscInt cX, PetscInt dX, const PetscScalar *M,
467
  PetscInt ldM, PetscInt rM, PetscInt cM);
1965 eromero 468
PetscErrorCode SlepcUpdateVectorsD(Vec *X, PetscInt cX, PetscScalar alpha,
469
  const PetscScalar *M, PetscInt ldM, PetscInt rM, PetscInt cM,
470
  PetscScalar *work, PetscInt lwork);
1747 eromero 471
PetscErrorCode VecsMult(PetscScalar *M, MatType_t sM, PetscInt ldM,
1634 slepc 472
                        Vec *U, PetscInt sU, PetscInt eU,
473
                        Vec *V, PetscInt sV, PetscInt eV,
1640 slepc 474
                        PetscScalar *workS0, PetscScalar *workS1);
1753 eromero 475
PetscErrorCode VecsMultS(PetscScalar *M, MatType_t sM, PetscInt ldM,
476
                         Vec *U, PetscInt sU, PetscInt eU,
477
                         Vec *V, PetscInt sV, PetscInt eV, DvdReduction *r,
478
                         DvdMult_copy_func *sr);
1795 eromero 479
PetscErrorCode VecsMultIb(PetscScalar *M, MatType_t sM, PetscInt ldM,
480
                          PetscInt rM, PetscInt cM, PetscScalar *auxS,
481
                          Vec V);
482
PetscErrorCode VecsMultIa(PetscScalar *M, MatType_t sM, PetscInt ldM,
483
                          Vec *U, PetscInt sU, PetscInt eU,
484
                          Vec *V, PetscInt sV, PetscInt eV);
1753 eromero 485
PetscErrorCode SlepcAllReduceSumBegin(DvdReductionChunk *ops,
486
                                      PetscInt max_size_ops,
487
                                      PetscScalar *in, PetscScalar *out,
488
                                      PetscInt max_size_in, DvdReduction *r,
489
                                      MPI_Comm comm);
490
PetscErrorCode SlepcAllReduceSum(DvdReduction *r, PetscInt size_in,
491
                                 DvdReductionPostF f, void *ptr,
492
                                 PetscScalar **in);
493
PetscErrorCode SlepcAllReduceSumEnd(DvdReduction *r);
1989 eromero 494
PetscErrorCode dvd_orthV(IP ip, Vec *DS, PetscInt size_DS, Vec *cX,
495
                         PetscInt size_cX, Vec *V, PetscInt V_new_s,
496
                         PetscInt V_new_e, PetscScalar *auxS, Vec auxV,
497
                         PetscRandom rand);
2555 eromero 498
PetscErrorCode dvd_BorthV(IP ip, Vec *DS, Vec *BDS, PetscInt size_DS, Vec *cX,
499
                         Vec *BcX, PetscInt size_cX, Vec *V, Vec *BV,
500
                         PetscInt V_new_s, PetscInt V_new_e,
501
                         PetscScalar *auxS, Vec auxV, PetscRandom rand);
1968 eromero 502
PetscErrorCode dvd_compute_eigenvectors(PetscInt n_, PetscScalar *S,
503
  PetscInt ldS_, PetscScalar *T, PetscInt ldT_, PetscScalar *pX,
504
  PetscInt ldpX_, PetscScalar *pY, PetscInt ldpY_, PetscScalar *auxS,
2216 jroman 505
  PetscInt size_auxS, PetscBool doProd);
2555 eromero 506
PetscErrorCode EPSSortDenseHEP(EPS eps, PetscInt n, PetscInt k, PetscReal *w, PetscScalar *V, PetscInt ldV);
1976 eromero 507
 
508
/* SLEPc interface routines */
509
PetscErrorCode SLEPcNotImplemented();
2324 jroman 510
PetscErrorCode EPSCreate_Davidson(EPS eps);
2348 jroman 511
PetscErrorCode EPSReset_Davidson(EPS eps);
2324 jroman 512
PetscErrorCode EPSSetUp_Davidson(EPS eps);
513
PetscErrorCode EPSSolve_Davidson(EPS eps);
2555 eromero 514
PetscErrorCode EPSComputeVectors_Davidson(EPS eps);
2324 jroman 515
PetscErrorCode EPSDavidsonSetKrylovStart_Davidson(EPS eps,PetscBool krylovstart);
516
PetscErrorCode EPSDavidsonGetKrylovStart_Davidson(EPS eps,PetscBool *krylovstart);
517
PetscErrorCode EPSDavidsonSetBlockSize_Davidson(EPS eps,PetscInt blocksize);
518
PetscErrorCode EPSDavidsonGetBlockSize_Davidson(EPS eps,PetscInt *blocksize);
519
PetscErrorCode EPSDavidsonSetRestart_Davidson(EPS eps,PetscInt minv,PetscInt plusk);
520
PetscErrorCode EPSDavidsonGetRestart_Davidson(EPS eps,PetscInt *minv,PetscInt *plusk);
521
PetscErrorCode EPSDavidsonGetInitialSize_Davidson(EPS eps,PetscInt *initialsize);
522
PetscErrorCode EPSDavidsonSetInitialSize_Davidson(EPS eps,PetscInt initialsize);
523
PetscErrorCode EPSDavidsonGetFix_Davidson(EPS eps,PetscReal *fix);
524
PetscErrorCode EPSDavidsonSetFix_Davidson(EPS eps,PetscReal fix);
2555 eromero 525
PetscErrorCode EPSDavidsonSetBOrth_Davidson(EPS eps,PetscBool borth);
526
PetscErrorCode EPSDavidsonGetBOrth_Davidson(EPS eps,PetscBool *borth);