Actual source code: pepkrylov.h
slepc-3.9.1 2018-05-02
1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-2018, Universitat Politecnica de Valencia, Spain
6: This file is part of SLEPc.
7: SLEPc is distributed under a 2-clause BSD license (see LICENSE).
8: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9: */
10: /*
11: Private header for TOAR and STOAR
12: */
17: PETSC_INTERN PetscErrorCode PEPExtractVectors_TOAR(PEP);
18: PETSC_INTERN PetscErrorCode MatMult_Func(Mat,Vec,Vec);
19: PETSC_INTERN PetscErrorCode MatDestroy_Func(Mat);
20: PETSC_INTERN PetscErrorCode PEPSolve_STOAR(PEP);
21: PETSC_INTERN PetscErrorCode PEPSolve_STOAR_QSlice(PEP);
22: PETSC_INTERN PetscErrorCode PEPSetUp_STOAR_QSlice(PEP);
23: PETSC_INTERN PetscErrorCode PEPReset_STOAR_QSlice(PEP);
25: /* Structure characterizing a shift in spectrum slicing */
26: typedef struct _n_shift *PEP_shift;
27: struct _n_shift {
28: PetscReal value;
29: PetscInt inertia;
30: PetscBool comp[2]; /* Shows completion of subintervals (left and right) */
31: PEP_shift neighb[2]; /* Adjacent shifts */
32: PetscInt index; /* Index in eig where found values are stored */
33: PetscInt neigs; /* Number of values found */
34: PetscReal ext[2]; /* Limits for accepted values */
35: PetscInt nsch[2]; /* Number of missing values for each subinterval */
36: PetscInt nconv[2]; /* Converged on each side (accepted or not) */
37: };
39: /* Identifies the TOAR vectors for each Pseudo-Lanczos vector in the global array */
40: typedef struct {
41: PetscInt nq;
42: PetscInt *q;
43: } PEP_QInfo;
45: /* Structure for storing the state of spectrum slicing */
46: struct _n_SR {
47: PetscReal int0,int1; /* Extremes of the interval */
48: PetscInt dir; /* Determines the order of values in eig (+1 incr, -1 decr) */
49: PetscBool hasEnd; /* Tells whether the interval has an end */
50: PetscBool dirch; /* Tells if dir has been changed */
51: PetscInt inertia0,inertia1;
52: PetscScalar *back;
53: PetscInt numEigs; /* Number of eigenvalues in the interval */
54: PetscInt indexEig;
55: PEP_shift sPres; /* Present shift */
56: PEP_shift *pending; /* Pending shifts array */
57: PetscInt nPend; /* Number of pending shifts */
58: PetscInt maxPend; /* Size of "pending" array */
59: PetscInt *idxDef0,*idxDef1; /* For deflation */
60: PetscInt ndef0,ndef1; /* Index in deflation arrays */
61: PetscInt nMAXCompl;
62: PetscInt iterCompl;
63: PetscInt itsKs; /* Krylovschur restarts */
64: PetscInt nleap;
65: PEP_shift s0; /* Initial shift */
66: PEP_shift sPrev;
67: PetscInt nv; /* position of restart vector */
68: BV V; /* full TOAR basis */
69: PetscScalar *S; /* TOAR coefficients */
70: PetscInt ld; /* Leading dimension for each block of S */
71: BV Vnext; /* temporary working basis during change of shift */
72: PetscScalar *eigr,*eigi; /* eigenvalues */
73: PetscReal *errest; /* error estimates */
74: PetscInt *perm; /* permutation */
75: PEP_QInfo *qinfo; /* TOAR vectors for each pseudo-Lanczos vector */
76: PetscInt intcorr; /* Global inertia correction */
77: Vec v[3];
78: EPS eps;
79: };
80: typedef struct _n_SR *PEP_SR;
82: typedef struct {
83: PetscReal keep; /* restart parameter */
84: PetscBool lock; /* locking/non-locking variant */
85: BV V; /* tensor basis vectors object for the linearization */
86: PEP_SR sr; /* spectrum slicing context */
87: PetscReal *shifts; /* array containing global shifts */
88: PetscInt *inertias; /* array containing global inertias */
89: PetscInt nshifts; /* elements in the arrays of shifts and inertias */
90: PetscInt nev; /* number of eigenvalues to compute */
91: PetscInt ncv; /* number of basis vectors */
92: PetscInt mpd; /* maximum dimension of projected problem */
93: PetscBool detect; /* check for zeros during factorizations */
94: PetscBool hyperbolic;/* hyperbolic problem flag */
95: } PEP_TOAR;
97: typedef struct {
98: PetscScalar scal;
99: Mat A;
100: } ShellMatCtx;
101: #endif