Subversion Repositories slepc-dev

Rev

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
1795 eromero 148
    correctXnorm;   /* if true, tol < |r|/|x| */
1619 slepc 149
 
150
  /**** Subspaces specification ****/
151
  Vec *V,           /* searching subspace */
1795 eromero 152
    *W,             /* testing subspace */
1751 eromero 153
    *cX,            /* converged right eigenvectors */
154
    *cY,            /* converged left eigenvectors */
1829 eromero 155
    *BcX,           /* basis of B*cX */
1735 eromero 156
    *AV,            /* A*V */
157
    *real_AV,       /* original A*V space */
158
    *BV,            /* B*V */
159
    *real_BV;       /* original B*V space */
1619 slepc 160
  PetscInt size_V,  /* size of V */
1735 eromero 161
    size_AV,        /* size of AV */
162
    size_BV,        /* size of BV */
1619 slepc 163
    size_cX,        /* size of cX */
1751 eromero 164
    size_cY,        /* size of cY */
1735 eromero 165
    size_D,         /* active vectors */
1619 slepc 166
    max_size_V,     /* max size of V */
167
    max_size_X,     /* max size of X */
1735 eromero 168
    max_size_AV,    /* max size of AV */
169
    max_size_BV;    /* max size of BV */
1805 eromero 170
  EPS eps;          /* Connection to SLEPc */
1619 slepc 171
 
172
  /**** Auxiliary space ****/
173
  Vec *auxV;        /* auxiliary vectors */
174
  PetscScalar
175
    *auxS;          /* auxiliary scalars */
176
  PetscInt
177
    size_auxV,      /* max size of auxV */
178
    size_auxS;      /* max size of auxS */
179
 
180
  /**** Eigenvalues and errors ****/
181
  PetscScalar
182
    *ceigr, *ceigi, /* converged eigenvalues */
183
    *eigr, *eigi;   /* current eigenvalues */
184
  PetscReal
1735 eromero 185
    *nR,            /* residual norm */
1764 eromero 186
    *nX,            /* X norm */
1735 eromero 187
    *errest;        /* relative error eigenpairs */
1619 slepc 188
 
189
  /**** Shared function and variables ****/
2021 eromero 190
  PetscErrorCode (*e_Vchanged)(struct _dvdDashboard*, PetscInt s_imm,
1619 slepc 191
                         PetscInt e_imm, PetscInt s_new, PetscInt e_new);
192
  void *e_Vchanged_data;
193
 
2021 eromero 194
  PetscErrorCode (*calcpairs_residual)(struct _dvdDashboard*, PetscInt s, PetscInt e,
1751 eromero 195
                                 Vec *R, PetscScalar *auxS, Vec auxV);
2021 eromero 196
  PetscErrorCode (*calcpairs_selectPairs)(struct _dvdDashboard*, PetscInt n);
1736 eromero 197
  void *calcpairs_residual_data;
2021 eromero 198
  PetscErrorCode (*calcpairs_X)(struct _dvdDashboard*, PetscInt s, PetscInt e,
1735 eromero 199
                          Vec *X);
2021 eromero 200
  PetscErrorCode (*calcpairs_Y)(struct _dvdDashboard*, PetscInt s, PetscInt e,
1809 eromero 201
                          Vec *Y);
1736 eromero 202
  PetscErrorCode (*improvex_precond)(struct _dvdDashboard*, PetscInt i, Vec x,
203
                  Vec Px);
204
  void *improvex_precond_data;
1960 eromero 205
  PetscErrorCode (*improvex_jd_proj_uv)(struct _dvdDashboard*, PetscInt i_s,
206
                                        PetscInt i_e, Vec **u, Vec **v,
1965 eromero 207
                                        Vec **kr, Vec **auxV_,
208
                                        PetscScalar *theta,
209
                                        PetscScalar *thetai,
210
                                        PetscScalar *pX, PetscScalar *pY,
211
                                        PetscInt ld);
1867 eromero 212
  PetscErrorCode (*improvex_jd_lit)(struct _dvdDashboard*, PetscInt i,
1960 eromero 213
                                    PetscScalar* theta, PetscScalar* thetai,
214
                                    PetscInt *maxits, PetscReal *tol);
1795 eromero 215
  PetscErrorCode (*calcpairs_W)(struct _dvdDashboard*);
216
  void *calcpairs_W_data;
217
  PetscErrorCode (*calcpairs_proj_trans)(struct _dvdDashboard*);
1883 eromero 218
  PetscErrorCode (*calcpairs_eigs_trans)(struct _dvdDashboard*);
219
  PetscErrorCode (*calcpairs_proj_res)(struct _dvdDashboard*, PetscInt r_s,
220
                  PetscInt r_e, Vec *R);
2018 eromero 221
  PetscErrorCode (*preTestConv)(struct _dvdDashboard*, PetscInt s, PetscInt pre,
222
                                PetscInt e, Vec *auxV, PetscScalar *auxS,
223
                                      PetscInt *nConv);
1619 slepc 224
 
2021 eromero 225
  PetscErrorCode (*e_newIteration)(struct _dvdDashboard*);
1619 slepc 226
  void *e_newIteration_data;
227
 
1751 eromero 228
  IP ipI;
1795 eromero 229
  IP ipV,           /* orthogonal routine options for V subspace */
230
    ipW;            /* orthogonal routine options for W subspace */
1751 eromero 231
 
1619 slepc 232
  dvdFunctionList
1883 eromero 233
    *startList,     /* starting list */
234
    *endList,       /* ending list */
1619 slepc 235
    *destroyList;   /* destructor list */
236
 
1735 eromero 237
  PetscScalar *H,   /* Projected problem matrix A*/
238
    *real_H,        /* original H */
239
    *G,             /* Projected problem matrix B*/
240
    *real_G,        /* original G */
1750 eromero 241
    *pX,            /* projected problem right eigenvectors */
242
    *pY,            /* projected problem left eigenvectors */
1795 eromero 243
    *MTX,           /* right transformation matrix */
244
    *MTY,           /* left transformation matrix */
1750 eromero 245
    *S,             /* first Schur matrix, S = pY'*H*pX */
1756 eromero 246
    *T,             /* second Schur matrix, T = pY'*G*pX */
247
    *cS,            /* first Schur matrix of converged pairs */
248
    *cT;            /* second Schur matrix of converged pairs */
1750 eromero 249
  MatType_t
250
    pX_type,        /* pX properties */
251
    pY_type,        /* pY properties */
1747 eromero 252
    sH,             /* H properties */
253
    sG;             /* G properties */
1735 eromero 254
  PetscInt ldH,     /* leading dimension of H */
1750 eromero 255
    ldpX,           /* leading dimension of pX */
256
    ldpY,           /* leading dimension of pY */
1795 eromero 257
    ldMTX,          /* leading dimension of MTX */
258
    ldMTY,          /* leading dimension of MTY */
1750 eromero 259
    ldS,            /* leading dimension of S */
260
    ldT,            /* leading dimension of T */
1756 eromero 261
    ldcS,           /* leading dimension of cS */
262
    ldcT,           /* leading dimension of cT */
1742 eromero 263
    size_H,         /* rows and columns in H */
264
    size_G,         /* rows and columns in G */
2244 eromero 265
    size_MT,        /* rows in MT */
266
    max_size_cS;    /* max size of cS and cT */
1619 slepc 267
 
1735 eromero 268
  PetscInt V_imm_s,
269
    V_imm_e,        /* unchanged V columns, V_imm_s:V_imm_e-1 */
270
    V_tra_s,
271
    V_tra_e,        /* V(V_tra_e:) = V*MT(V_tra_s:V_tra_e-1) */
272
    V_new_s,
273
    V_new_e;        /* added to V the columns V_new_s:V_new_e */
1975 eromero 274
 
2012 eromero 275
  MT_type_t MT_type;
276
  orthoV_type_t orthoV_type;
277
 
1975 eromero 278
  PetscRandom rand; /* random seed */
1992 eromero 279
  void* prof_data;  /* profiler data */
1619 slepc 280
} dvdDashboard;
281
 
2244 eromero 282
/* Add the function fun at the beginning of list */
283
#define DVD_FL_ADD_BEGIN(list, fun) { \
1619 slepc 284
  dvdFunctionList *fl=(list); \
285
  PetscErrorCode ierr; \
286
  ierr = PetscMalloc(sizeof(dvdFunctionList), &(list)); CHKERRQ(ierr); \
2021 eromero 287
  (list)->f = (PetscErrorCode(*)(void*))(fun); \
1619 slepc 288
  (list)->next = fl; }
289
 
2244 eromero 290
/* Add the function fun at the end of list */
291
#define DVD_FL_ADD_END(list, fun) { \
292
  if ((list)) {DVD_FL_ADD_END0(list, fun);} \
293
  else {DVD_FL_ADD_BEGIN(list, fun);} }
294
 
295
#define DVD_FL_ADD_END0(list, fun) { \
296
  dvdFunctionList *fl=(list); \
297
  PetscErrorCode ierr; \
298
  for(;fl->next; fl = fl->next); \
299
  ierr = PetscMalloc(sizeof(dvdFunctionList), &fl->next); CHKERRQ(ierr); \
300
  fl->next->f = (PetscErrorCode(*)(void*))(fun); \
301
  fl->next->next = PETSC_NULL; }
302
 
303
#define DVD_FL_ADD(list, fun) DVD_FL_ADD_END(list, fun)
304
 
1883 eromero 305
#define DVD_FL_CALL(list, arg0) { \
1619 slepc 306
  dvdFunctionList *fl; \
1883 eromero 307
  for(fl=(list); fl; fl=fl->next) (*(dvdCallback)fl->f)((arg0)); }
1619 slepc 308
 
309
#define DVD_FL_DEL(list) { \
310
  dvdFunctionList *fl=(list), *oldfl; \
311
  PetscErrorCode ierr; \
312
  while(fl) { \
313
    oldfl = fl; fl = fl->next; ierr = PetscFree(oldfl); CHKERRQ(ierr); }}
314
 
315
/*
316
  The blackboard configuration structure: saves information about the memory
317
  and other requirements
318
*/
319
typedef struct {
2047 eromero 320
  PetscInt max_size_V,  /* max size of the searching subspace */
1619 slepc 321
    max_size_X,         /* max size of X */
2047 eromero 322
    size_V,             /* real size of V */
1619 slepc 323
    max_size_oldX,      /* max size of oldX */
324
    max_size_auxV,      /* max size of auxiliary vecs */
325
    max_size_auxS,      /* max size of auxiliary scalars */
1966 eromero 326
    max_nev,            /* max number of converged pairs */
1619 slepc 327
    own_vecs,           /* number of global vecs */
328
    own_scalars;        /* number of local scalars */
329
  Vec *free_vecs;       /* free global vectors */
330
  PetscScalar
331
    *free_scalars;      /* free scalars */
1734 eromero 332
  PetscInt state;       /* method states:
1619 slepc 333
                            0: preconfiguring
334
                            1: configuring
335
                            2: running
336
                        */
337
} dvdBlackboard;
338
 
1734 eromero 339
#define DVD_STATE_PRECONF 0
340
#define DVD_STATE_CONF 1
341
#define DVD_STATE_RUN 2
1619 slepc 342
 
343
/* Shared types */
1736 eromero 344
typedef void* dvdPrecondData; // DEPRECATED!!
345
typedef PetscErrorCode (*dvdPrecond)(dvdDashboard*, PetscInt i, Vec x, Vec Px);
2021 eromero 346
typedef PetscErrorCode (*dvdCallback)(dvdDashboard*);
347
typedef PetscErrorCode (*e_Vchanged_type)(dvdDashboard*, PetscInt s_imm,
1619 slepc 348
                         PetscInt e_imm, PetscInt s_new, PetscInt e_new);
2216 jroman 349
typedef PetscBool (*isRestarting_type)(dvdDashboard*);
2021 eromero 350
typedef PetscErrorCode (*e_newIteration_type)(dvdDashboard*);
351
typedef PetscErrorCode (*improveX_type)(dvdDashboard*, Vec *D, PetscInt max_size_D,
1735 eromero 352
                                  PetscInt r_s, PetscInt r_e, PetscInt *size_D);
1619 slepc 353
 
1753 eromero 354
/* Structures for blas */
355
typedef PetscErrorCode (*DvdReductionPostF)(PetscScalar*,PetscInt,void*);
356
typedef struct {
357
  PetscScalar
358
    *out;               /* final vector */
359
  PetscInt
360
    size_out;           /* size of out */
361
  DvdReductionPostF
362
    f;                  /* function called after the reduction */
363
  void *ptr;
364
} DvdReductionChunk;  
365
 
366
typedef struct {
367
  PetscScalar
368
    *in,                /* vector to sum-up with more nodes */
369
    *out;               /* final vector */
370
  PetscInt size_in,     /* size of in */
371
    max_size_in;        /* max size of in */
372
  DvdReductionChunk
373
    *ops;               /* vector of reduction operations */
374
  PetscInt
375
    size_ops,           /* size of ops */
376
    max_size_ops;       /* max size of ops */
377
  MPI_Comm comm;        /* MPI communicator */
378
} DvdReduction;
379
 
380
typedef struct {
381
  PetscInt i0, i1, i2, ld, s0, e0, s1, e1;
382
  PetscScalar *M;
383
} DvdMult_copy_func;
384
 
1619 slepc 385
/* Routines for initV step */
2021 eromero 386
PetscErrorCode dvd_initV_classic(dvdDashboard *d, dvdBlackboard *b, PetscInt k);
2188 eromero 387
PetscErrorCode dvd_initV_user(dvdDashboard *d, dvdBlackboard *b,
1875 eromero 388
                        PetscInt size_userV, PetscInt k);
2021 eromero 389
PetscErrorCode dvd_initV_krylov(dvdDashboard *d, dvdBlackboard *b, PetscInt k);
1619 slepc 390
 
391
/* Routines for calcPairs step */
2021 eromero 392
PetscErrorCode dvd_calcpairs_rr(dvdDashboard *d, dvdBlackboard *b);
393
PetscErrorCode dvd_calcpairs_qz(dvdDashboard *d, dvdBlackboard *b, IP ip);
1619 slepc 394
 
395
/* Routines for improveX step */
2021 eromero 396
PetscErrorCode dvd_improvex_jd(dvdDashboard *d, dvdBlackboard *b, KSP ksp,
1965 eromero 397
                         PetscInt max_bs);
2021 eromero 398
PetscErrorCode dvd_improvex_jd_proj_uv(dvdDashboard *d, dvdBlackboard *b,
1980 eromero 399
                                 ProjType_t p);
2021 eromero 400
PetscErrorCode dvd_improvex_jd_lit_const(dvdDashboard *d, dvdBlackboard *b,
1883 eromero 401
                                   PetscInt maxits, PetscReal tol,
402
                                   PetscReal fix);
1619 slepc 403
 
404
/* Routines for testConv step */
2021 eromero 405
PetscErrorCode dvd_testconv_basic(dvdDashboard *d, dvdBlackboard *b);
406
PetscErrorCode dvd_testconv_slepc(dvdDashboard *d, dvdBlackboard *b);
1619 slepc 407
 
408
/* Routines for management of V */
2021 eromero 409
PetscErrorCode dvd_managementV_basic(dvdDashboard *d, dvdBlackboard *b,
2023 eromero 410
                                     PetscInt bs, PetscInt max_size_V,
411
                                     PetscInt mpd, PetscInt min_size_V,
2216 jroman 412
                                     PetscInt plusk, PetscBool harm,
413
                                     PetscBool allResiduals);
1619 slepc 414
 
415
/* Some utilities */
1764 eromero 416
PetscErrorCode dvd_static_precond_PC(dvdDashboard *d, dvdBlackboard *b, PC pc);
1736 eromero 417
PetscErrorCode dvd_jacobi_precond(dvdDashboard *d, dvdBlackboard *b);
1992 eromero 418
PetscErrorCode dvd_profiler(dvdDashboard *d, dvdBlackboard *b);
419
PetscErrorCode dvd_prof_init();
1795 eromero 420
PetscErrorCode dvd_harm_conf(dvdDashboard *d, dvdBlackboard *b,
2216 jroman 421
                             HarmType_t mode, PetscBool fixedTarget,
1795 eromero 422
                             PetscScalar t);
1619 slepc 423
 
424
/* Methods */
425
PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d, dvdBlackboard *b,
2023 eromero 426
  PetscInt max_size_V, PetscInt mpd, PetscInt min_size_V, PetscInt bs,
2244 eromero 427
  PetscInt ini_size_V, PetscInt size_initV, PetscInt plusk,
2216 jroman 428
  HarmType_t harmMode, KSP ksp, InitType_t init, PetscBool allResiduals);
1619 slepc 429
PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d, dvdBlackboard *b,
2023 eromero 430
  PetscInt max_size_V, PetscInt mpd, PetscInt min_size_V, PetscInt bs,
2244 eromero 431
  PetscInt ini_size_V, PetscInt size_initV, PetscInt plusk,
2216 jroman 432
  IP ip, HarmType_t harmMode, PetscBool fixedTarget, PetscScalar t, KSP ksp,
433
  PetscReal fix, InitType_t init, PetscBool allResiduals);
1619 slepc 434
 
435
/* BLAS routines */
436
PetscErrorCode SlepcDenseMatProd(PetscScalar *C, PetscInt _ldC, PetscScalar b,
437
  PetscScalar a,
2216 jroman 438
  const PetscScalar *A, PetscInt _ldA, PetscInt rA, PetscInt cA, PetscBool At,
439
  const PetscScalar *B, PetscInt _ldB, PetscInt rB, PetscInt cB, PetscBool Bt);
1747 eromero 440
PetscErrorCode SlepcDenseMatProdTriang(
441
  PetscScalar *C, MatType_t sC, PetscInt ldC,
442
  const PetscScalar *A, MatType_t sA, PetscInt ldA, PetscInt rA, PetscInt cA,
2216 jroman 443
  PetscBool At,
1747 eromero 444
  const PetscScalar *B, MatType_t sB, PetscInt ldB, PetscInt rB, PetscInt cB,
2216 jroman 445
  PetscBool Bt);
1735 eromero 446
PetscErrorCode SlepcDenseMatInvProd(
447
  PetscScalar *A, PetscInt _ldA, PetscInt dimA,
448
  PetscScalar *B, PetscInt _ldB, PetscInt rB, PetscInt cB, PetscInt *auxI);
1750 eromero 449
PetscErrorCode SlepcDenseNorm(PetscScalar *A, PetscInt ldA, PetscInt _rA,
1965 eromero 450
                              PetscInt cA, PetscScalar *eigi);
1742 eromero 451
PetscErrorCode SlepcDenseOrth(PetscScalar *A, PetscInt _ldA, PetscInt _rA,
452
                              PetscInt _cA, PetscScalar *auxS, PetscInt _lauxS,
453
                              PetscInt *ncA);
454
PetscErrorCode SlepcDenseCopy(PetscScalar *Y, PetscInt ldY, PetscScalar *X,
455
                              PetscInt ldX, PetscInt rX, PetscInt cX);
1752 eromero 456
PetscErrorCode SlepcDenseCopyTriang(PetscScalar *Y, MatType_t sY, PetscInt ldY,
457
                                    PetscScalar *X, MatType_t sX, PetscInt ldX,
458
                                    PetscInt rX, PetscInt cX);
1675 slepc 459
PetscErrorCode SlepcUpdateVectorsZ(Vec *Y, PetscScalar beta, PetscScalar alpha,
460
  Vec *X, PetscInt cX, const PetscScalar *M, PetscInt ldM, PetscInt rM,
461
  PetscInt cM);
1960 eromero 462
PetscErrorCode SlepcUpdateVectorsS(Vec *Y, PetscInt dY, PetscScalar beta,
463
  PetscScalar alpha, Vec *X, PetscInt cX, PetscInt dX, const PetscScalar *M,
464
  PetscInt ldM, PetscInt rM, PetscInt cM);
1965 eromero 465
PetscErrorCode SlepcUpdateVectorsD(Vec *X, PetscInt cX, PetscScalar alpha,
466
  const PetscScalar *M, PetscInt ldM, PetscInt rM, PetscInt cM,
467
  PetscScalar *work, PetscInt lwork);
1747 eromero 468
PetscErrorCode VecsMult(PetscScalar *M, MatType_t sM, PetscInt ldM,
1634 slepc 469
                        Vec *U, PetscInt sU, PetscInt eU,
470
                        Vec *V, PetscInt sV, PetscInt eV,
1640 slepc 471
                        PetscScalar *workS0, PetscScalar *workS1);
1753 eromero 472
PetscErrorCode VecsMultS(PetscScalar *M, MatType_t sM, PetscInt ldM,
473
                         Vec *U, PetscInt sU, PetscInt eU,
474
                         Vec *V, PetscInt sV, PetscInt eV, DvdReduction *r,
475
                         DvdMult_copy_func *sr);
1808 eromero 476
PetscErrorCode VecsMultIc(PetscScalar *M, MatType_t sM, PetscInt ldM,
477
                          PetscInt rM, PetscInt cM, Vec V);
1795 eromero 478
PetscErrorCode VecsMultIb(PetscScalar *M, MatType_t sM, PetscInt ldM,
479
                          PetscInt rM, PetscInt cM, PetscScalar *auxS,
480
                          Vec V);
481
PetscErrorCode VecsMultIa(PetscScalar *M, MatType_t sM, PetscInt ldM,
482
                          Vec *U, PetscInt sU, PetscInt eU,
483
                          Vec *V, PetscInt sV, PetscInt eV);
1753 eromero 484
PetscErrorCode SlepcAllReduceSumBegin(DvdReductionChunk *ops,
485
                                      PetscInt max_size_ops,
486
                                      PetscScalar *in, PetscScalar *out,
487
                                      PetscInt max_size_in, DvdReduction *r,
488
                                      MPI_Comm comm);
489
PetscErrorCode SlepcAllReduceSum(DvdReduction *r, PetscInt size_in,
490
                                 DvdReductionPostF f, void *ptr,
491
                                 PetscScalar **in);
492
PetscErrorCode SlepcAllReduceSumEnd(DvdReduction *r);
1989 eromero 493
PetscErrorCode dvd_orthV(IP ip, Vec *DS, PetscInt size_DS, Vec *cX,
494
                         PetscInt size_cX, Vec *V, PetscInt V_new_s,
495
                         PetscInt V_new_e, PetscScalar *auxS, Vec auxV,
496
                         PetscRandom rand);
1968 eromero 497
PetscErrorCode dvd_compute_eigenvectors(PetscInt n_, PetscScalar *S,
498
  PetscInt ldS_, PetscScalar *T, PetscInt ldT_, PetscScalar *pX,
499
  PetscInt ldpX_, PetscScalar *pY, PetscInt ldpY_, PetscScalar *auxS,
2216 jroman 500
  PetscInt size_auxS, PetscBool doProd);
2034 eromero 501
PetscErrorCode dvd_compute_eigenvalues(PetscInt n, PetscScalar *S,
502
  PetscInt ldS, PetscScalar *T, PetscInt ldT, PetscScalar *eigr,
503
  PetscScalar *eigi);
1976 eromero 504
 
505
/* SLEPc interface routines */
506
PetscErrorCode SLEPcNotImplemented();
1982 eromero 507
PetscErrorCode EPSCreate_DAVIDSON(EPS eps);
1992 eromero 508
PetscErrorCode EPSDestroy_DAVIDSON(EPS eps);
1976 eromero 509
PetscErrorCode EPSSetUp_DAVIDSON(EPS eps);
510
PetscErrorCode EPSSolve_DAVIDSON(EPS eps);
511
PetscErrorCode EPSComputeVectors_QZ(EPS eps);
2216 jroman 512
PetscErrorCode EPSDAVIDSONSetKrylovStart_DAVIDSON(EPS eps,PetscBool krylovstart);
513
PetscErrorCode EPSDAVIDSONGetKrylovStart_DAVIDSON(EPS eps,PetscBool *krylovstart);
1980 eromero 514
PetscErrorCode EPSDAVIDSONSetBlockSize_DAVIDSON(EPS eps,PetscInt blocksize);
515
PetscErrorCode EPSDAVIDSONGetBlockSize_DAVIDSON(EPS eps,PetscInt *blocksize);
516
PetscErrorCode EPSDAVIDSONSetRestart_DAVIDSON(EPS eps,PetscInt minv,PetscInt plusk);
517
PetscErrorCode EPSDAVIDSONGetRestart_DAVIDSON(EPS eps,PetscInt *minv,PetscInt *plusk);
518
PetscErrorCode EPSDAVIDSONGetInitialSize_DAVIDSON(EPS eps,PetscInt *initialsize);
519
PetscErrorCode EPSDAVIDSONSetInitialSize_DAVIDSON(EPS eps,PetscInt initialsize);
1995 eromero 520
PetscErrorCode EPSDAVIDSONGetFix_DAVIDSON(EPS eps,PetscReal *fix);
521
PetscErrorCode EPSDAVIDSONSetFix_DAVIDSON(EPS eps,PetscReal fix);