Actual source code: krylovschur.h

slepc-3.22.2 2024-12-02
Report Typos and Errors
  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 EPSGetArbitraryValues(EPS,PetscScalar*,PetscScalar*);
 28: SLEPC_INTERN PetscErrorCode EPSKrylovSchurGetChildEPS(EPS,EPS*);

 30: /* Structure characterizing a shift in spectrum slicing */
 31: typedef struct _n_shift *EPS_shift;
 32: struct _n_shift {
 33:   PetscReal     value;
 34:   PetscInt      inertia;
 35:   PetscBool     comp[2];      /* Shows completion of subintervals (left and right) */
 36:   EPS_shift     neighb[2];    /* Adjacent shifts */
 37:   PetscInt      index;        /* Index in eig where found values are stored */
 38:   PetscInt      neigs;        /* Number of values found */
 39:   PetscReal     ext[2];       /* Limits for accepted values */
 40:   PetscInt      nsch[2];      /* Number of missing values for each subinterval */
 41:   PetscInt      nconv[2];     /* Converged on each side (accepted or not) */
 42:   PetscBool     rep;          /* Present shift is reused */
 43: };

 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:   PetscInt      inertia0,inertia1;
 51:   PetscScalar   *back;
 52:   PetscInt      numEigs;      /* Number of eigenvalues in the interval */
 53:   PetscInt      indexEig;
 54:   EPS_shift     sPres;        /* Present shift */
 55:   EPS_shift     *pending;     /* Pending shifts array */
 56:   PetscInt      nPend;        /* Number of pending shifts */
 57:   PetscInt      maxPend;      /* Size of "pending" array */
 58:   PetscInt      *idxDef;      /* For deflation */
 59:   PetscInt      nMAXCompl;
 60:   PetscInt      iterCompl;
 61:   PetscInt      itsKs;        /* Krylovschur restarts */
 62:   PetscInt      nleap;
 63:   EPS_shift     s0;           /* Initial shift */
 64:   PetscScalar   *S;           /* Matrix for projected problem */
 65:   PetscInt      nS;
 66:   EPS_shift     sPrev;
 67:   PetscInt      nv;           /* position of restart vector */
 68:   BV            V;            /* working basis (for subsolve) */
 69:   BV            Vnext;        /* temporary working basis during change of shift */
 70:   PetscScalar   *eigr,*eigi;  /* eigenvalues (for subsolve) */
 71:   PetscReal     *errest;      /* error estimates (for subsolve) */
 72:   PetscInt      *perm;        /* permutation (for subsolve) */
 73: };
 74: typedef struct _n_SR *EPS_SR;

 76: typedef struct {
 77:   PetscReal        keep;               /* restart parameter */
 78:   PetscBool        lock;               /* locking/non-locking variant */
 79:   /* the following are used only in spectrum slicing */
 80:   EPS_SR           sr;                 /* spectrum slicing context */
 81:   PetscInt         nev;                /* number of eigenvalues to compute */
 82:   PetscInt         ncv;                /* number of basis vectors */
 83:   PetscInt         mpd;                /* maximum dimension of projected problem */
 84:   PetscInt         npart;              /* number of partitions of subcommunicator */
 85:   PetscBool        detect;             /* check for zeros during factorizations */
 86:   PetscReal        *subintervals;      /* partition of global interval */
 87:   PetscBool        subintset;          /* subintervals set by user */
 88:   PetscMPIInt      *nconv_loc;         /* converged eigenpairs for each subinterval */
 89:   EPS              eps;                /* additional eps for slice runs */
 90:   PetscBool        global;             /* flag distinguishing global from local eps */
 91:   PetscReal        *shifts;            /* array containing global shifts */
 92:   PetscInt         *inertias;          /* array containing global inertias */
 93:   PetscInt         nshifts;            /* elements in the arrays of shifts and inertias */
 94:   PetscSubcomm     subc;               /* context for subcommunicators */
 95:   MPI_Comm         commrank;           /* group processes with same rank in subcommunicators */
 96:   PetscBool        commset;            /* flag indicating that commrank was created */
 97:   PetscObjectState Astate,Bstate;      /* state of subcommunicator matrices */
 98:   PetscObjectId    Aid,Bid;            /* Id of subcommunicator matrices */
 99:   IS               isrow,iscol;        /* index sets used in update of subcomm mats */
100:   Mat              *submata,*submatb;  /* seq matrices used in update of subcomm mats */
101:   /* the following are used only in filter */
102:   PetscBool        estimatedrange;     /* the filter range was not set by the user */
103:   /* the following are used only for BSE problem type */
104:   EPSKrylovSchurBSEType bse;           /* the BSE method */
105: } EPS_KRYLOVSCHUR;