1: /*
2: Private header for Krylov-Schur.
4: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5: SLEPc - Scalable Library for Eigenvalue Problem Computations
6: Copyright (c) 2002-2016, Universitat Politecnica de Valencia, Spain
8: This file is part of SLEPc.
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.
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.
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: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22: */
27: PETSC_INTERN PetscErrorCode EPSReset_KrylovSchur_Slice(EPS);
28: PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Default(EPS);
29: PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Symm(EPS);
30: PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Slice(EPS);
31: PETSC_INTERN PetscErrorCode EPSSetUp_KrylovSchur_Slice(EPS);
32: PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Indefinite(EPS);
33: PETSC_INTERN PetscErrorCode EPSGetArbitraryValues(EPS,PetscScalar*,PetscScalar*);
35: /* Structure characterizing a shift in spectrum slicing */
36: typedef struct _n_shift *EPS_shift;
37: struct _n_shift {
38: PetscReal value;
39: PetscInt inertia;
40: PetscBool comp[2]; /* Shows completion of subintervals (left and right) */
41: EPS_shift neighb[2]; /* Adjacent shifts */
42: PetscInt index; /* Index in eig where found values are stored */
43: PetscInt neigs; /* Number of values found */
44: PetscReal ext[2]; /* Limits for accepted values */
45: PetscInt nsch[2]; /* Number of missing values for each subinterval */
46: PetscInt nconv[2]; /* Converged on each side (accepted or not) */
47: };
49: /* Structure for storing the state of spectrum slicing */
50: struct _n_SR {
51: PetscReal int0,int1; /* Extremes of the interval */
52: PetscInt dir; /* Determines the order of values in eig (+1 incr, -1 decr) */
53: PetscBool hasEnd; /* Tells whether the interval has an end */
54: PetscInt inertia0,inertia1;
55: PetscScalar *back;
56: PetscInt numEigs; /* Number of eigenvalues in the interval */
57: PetscInt indexEig;
58: EPS_shift sPres; /* Present shift */
59: EPS_shift *pending; /* Pending shifts array */
60: PetscInt nPend; /* Number of pending shifts */
61: PetscInt maxPend; /* Size of "pending" array */
62: PetscInt *idxDef; /* For deflation */
63: PetscInt nMAXCompl;
64: PetscInt iterCompl;
65: PetscInt itsKs; /* Krylovschur restarts */
66: PetscInt nleap;
67: EPS_shift s0; /* Initial shift */
68: PetscScalar *S; /* Matrix for projected problem */
69: PetscInt nS;
70: EPS_shift sPrev;
71: PetscInt nv; /* position of restart vector */
72: BV V; /* working basis (for subsolve) */
73: BV Vnext; /* temporary working basis during change of shift */
74: PetscScalar *eigr,*eigi; /* eigenvalues (for subsolve) */
75: PetscReal *errest; /* error estimates (for subsolve) */
76: PetscInt *perm; /* permutation (for subsolve) */
77: };
78: typedef struct _n_SR *EPS_SR;
80: typedef struct {
81: PetscReal keep; /* restart parameter */
82: PetscBool lock; /* locking/non-locking variant */
83: /* the following are used only in spectrum slicing */
84: EPS_SR sr; /* spectrum slicing context */
85: PetscInt nev; /* number of eigenvalues to compute */
86: PetscInt ncv; /* number of basis vectors */
87: PetscInt mpd; /* maximum dimension of projected problem */
88: PetscInt npart; /* number of partitions of subcommunicator */
89: PetscBool detect; /* check for zeros during factorizations */
90: PetscReal *subintervals; /* partition of global interval */
91: PetscBool subintset; /* subintervals set by user */
92: PetscMPIInt *nconv_loc; /* converged eigenpairs for each subinterval */
93: EPS eps; /* additional eps for slice runs */
94: PetscBool global; /* flag distinguishing global from local eps */
95: PetscReal *shifts; /* array containing global shifts */
96: PetscInt *inertias; /* array containing global inertias */
97: PetscInt nshifts; /* elements in the arrays of shifts and inertias */
98: PetscSubcomm subc; /* context for subcommunicators */
99: MPI_Comm commrank; /* group processes with same rank in subcommunicators */
100: PetscBool commset; /* flag indicating that commrank was created */
101: PetscObjectState Astate,Bstate; /* state of subcommunicator matrices */
102: PetscObjectId Aid,Bid; /* Id of subcommunicator matrices */
103: IS isrow,iscol; /* index sets used in update of subcomm mats */
104: Mat *submata,*submatb; /* seq matrices used in update of subcomm mats */
105: } EPS_KRYLOVSCHUR;
107: #endif