Actual source code: krylovschur.h
slepc-3.21.1 2024-04-26
1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-, 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: #pragma once
16: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Default(EPS);
17: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_TwoSided(EPS);
18: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Slice(EPS);
19: SLEPC_INTERN PetscErrorCode EPSSetUp_KrylovSchur_Slice(EPS);
20: SLEPC_INTERN PetscErrorCode EPSReset_KrylovSchur_Slice(EPS);
21: SLEPC_INTERN PetscErrorCode EPSDestroy_KrylovSchur_Slice(EPS);
22: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Indefinite(EPS);
23: SLEPC_INTERN PetscErrorCode EPSGetArbitraryValues(EPS,PetscScalar*,PetscScalar*);
24: SLEPC_INTERN PetscErrorCode EPSKrylovSchurGetChildEPS(EPS,EPS*);
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: PetscBool rep; /* Present shift is reused */
39: };
41: /* Structure for storing the state of spectrum slicing */
42: struct _n_SR {
43: PetscReal int0,int1; /* Extremes of the interval */
44: PetscInt dir; /* Determines the order of values in eig (+1 incr, -1 decr) */
45: PetscBool hasEnd; /* Tells whether the interval has an end */
46: PetscInt inertia0,inertia1;
47: PetscScalar *back;
48: PetscInt numEigs; /* Number of eigenvalues in the interval */
49: PetscInt indexEig;
50: EPS_shift sPres; /* Present shift */
51: EPS_shift *pending; /* Pending shifts array */
52: PetscInt nPend; /* Number of pending shifts */
53: PetscInt maxPend; /* Size of "pending" array */
54: PetscInt *idxDef; /* For deflation */
55: PetscInt nMAXCompl;
56: PetscInt iterCompl;
57: PetscInt itsKs; /* Krylovschur restarts */
58: PetscInt nleap;
59: EPS_shift s0; /* Initial shift */
60: PetscScalar *S; /* Matrix for projected problem */
61: PetscInt nS;
62: EPS_shift sPrev;
63: PetscInt nv; /* position of restart vector */
64: BV V; /* working basis (for subsolve) */
65: BV Vnext; /* temporary working basis during change of shift */
66: PetscScalar *eigr,*eigi; /* eigenvalues (for subsolve) */
67: PetscReal *errest; /* error estimates (for subsolve) */
68: PetscInt *perm; /* permutation (for subsolve) */
69: };
70: typedef struct _n_SR *EPS_SR;
72: typedef struct {
73: PetscReal keep; /* restart parameter */
74: PetscBool lock; /* locking/non-locking variant */
75: /* the following are used only in spectrum slicing */
76: EPS_SR sr; /* spectrum slicing context */
77: PetscInt nev; /* number of eigenvalues to compute */
78: PetscInt ncv; /* number of basis vectors */
79: PetscInt mpd; /* maximum dimension of projected problem */
80: PetscInt npart; /* number of partitions of subcommunicator */
81: PetscBool detect; /* check for zeros during factorizations */
82: PetscReal *subintervals; /* partition of global interval */
83: PetscBool subintset; /* subintervals set by user */
84: PetscMPIInt *nconv_loc; /* converged eigenpairs for each subinterval */
85: EPS eps; /* additional eps for slice runs */
86: PetscBool global; /* flag distinguishing global from local eps */
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: PetscSubcomm subc; /* context for subcommunicators */
91: MPI_Comm commrank; /* group processes with same rank in subcommunicators */
92: PetscBool commset; /* flag indicating that commrank was created */
93: PetscObjectState Astate,Bstate; /* state of subcommunicator matrices */
94: PetscObjectId Aid,Bid; /* Id of subcommunicator matrices */
95: IS isrow,iscol; /* index sets used in update of subcomm mats */
96: Mat *submata,*submatb; /* seq matrices used in update of subcomm mats */
97: /* the following are used only in filter */
98: PetscBool estimatedrange; /* the filter range was not set by the user */
99: } EPS_KRYLOVSCHUR;