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