Actual source code: krylovschur.h
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 EPSSetUp_KrylovSchur_BSE(EPS);
24: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_BSE_Shao(EPS);
25: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_BSE_Gruning(EPS);
26: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_BSE_ProjectedBSE(EPS);
27: SLEPC_INTERN PetscErrorCode EPSSetUp_KrylovSchur_Hamilt(EPS);
28: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Hamilt(EPS);
29: SLEPC_INTERN PetscErrorCode EPSSetUp_KrylovSchur_LREP(EPS);
30: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_LREP_Teng(EPS);
31: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_LREP_Zhong(EPS);
32: SLEPC_INTERN PetscErrorCode EPSGetArbitraryValues(EPS,PetscScalar*,PetscScalar*);
33: SLEPC_INTERN PetscErrorCode EPSKrylovSchurGetChildEPS(EPS,EPS*);
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: PetscBool rep; /* Present shift is reused */
48: };
50: /* Structure for storing the state of spectrum slicing */
51: struct _n_SR {
52: PetscReal int0,int1; /* Extremes of the interval */
53: PetscInt dir; /* Determines the order of values in eig (+1 incr, -1 decr) */
54: PetscBool hasEnd; /* Tells whether the interval has an end */
55: PetscInt inertia0,inertia1;
56: PetscScalar *back;
57: PetscInt numEigs; /* Number of eigenvalues in the interval */
58: PetscInt indexEig;
59: EPS_shift sPres; /* Present shift */
60: EPS_shift *pending; /* Pending shifts array */
61: PetscInt nPend; /* Number of pending shifts */
62: PetscInt maxPend; /* Size of "pending" array */
63: PetscInt *idxDef; /* For deflation */
64: PetscInt nMAXCompl;
65: PetscInt iterCompl;
66: PetscInt itsKs; /* Krylovschur restarts */
67: PetscInt nleap;
68: EPS_shift s0; /* Initial shift */
69: PetscScalar *S; /* Matrix for projected problem */
70: PetscInt nS;
71: EPS_shift sPrev;
72: PetscInt nv; /* position of restart vector */
73: BV V; /* working basis (for subsolve) */
74: BV Vnext; /* temporary working basis during change of shift */
75: PetscScalar *eigr,*eigi; /* eigenvalues (for subsolve) */
76: PetscReal *errest; /* error estimates (for subsolve) */
77: PetscInt *perm; /* permutation (for subsolve) */
78: };
79: typedef struct _n_SR *EPS_SR;
81: typedef struct {
82: PetscReal keep; /* restart parameter */
83: PetscBool lock; /* locking/non-locking variant */
84: /* the following are used only in spectrum slicing */
85: EPS_SR sr; /* spectrum slicing context */
86: PetscInt nev; /* number of eigenvalues to compute */
87: PetscInt ncv; /* number of basis vectors */
88: PetscInt mpd; /* maximum dimension of projected problem */
89: PetscInt npart; /* number of partitions of subcommunicator */
90: PetscBool detect; /* check for zeros during factorizations */
91: PetscReal *subintervals; /* partition of global interval */
92: PetscBool subintset; /* subintervals set by user */
93: PetscMPIInt *nconv_loc; /* converged eigenpairs for each subinterval */
94: EPS eps; /* additional eps for slice runs */
95: PetscBool global; /* flag distinguishing global from local eps */
96: PetscReal *shifts; /* array containing global shifts */
97: PetscInt *inertias; /* array containing global inertias */
98: PetscInt nshifts; /* elements in the arrays of shifts and inertias */
99: PetscSubcomm subc; /* context for subcommunicators */
100: MPI_Comm commrank; /* group processes with same rank in subcommunicators */
101: PetscBool commset; /* flag indicating that commrank was created */
102: MatState Astate,Bstate; /* state 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: /* the following are used only in filter */
106: PetscBool estimatedrange; /* the filter range was not set by the user */
107: /* the following are used only for BSE/LREP problem types */
108: EPSKrylovSchurBSEType bse; /* the BSE method */
109: EPSKrylovSchurLREPType lrep; /* the LREP method */
110: } EPS_KRYLOVSCHUR;