Date: 2022-11-02T11:46:42+00:00

Actual source code: krylovschur.h
slepc-3.18.1 2022-11-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: #if !defined(SLEPC_KRYLOVSCHUR_H)
     15: #define SLEPC_KRYLOVSCHUR_H

     17: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Default(EPS);
     18: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_TwoSided(EPS);
     19: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Slice(EPS);
     20: SLEPC_INTERN PetscErrorCode EPSSetUp_KrylovSchur_Slice(EPS);
     21: SLEPC_INTERN PetscErrorCode EPSReset_KrylovSchur_Slice(EPS);
     22: SLEPC_INTERN PetscErrorCode EPSDestroy_KrylovSchur_Slice(EPS);
     23: SLEPC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Indefinite(EPS);
     24: SLEPC_INTERN PetscErrorCode EPSGetArbitraryValues(EPS,PetscScalar*,PetscScalar*);
     25: SLEPC_INTERN PetscErrorCode EPSKrylovSchurGetChildEPS(EPS,EPS*);

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

     42: /* Structure for storing the state of spectrum slicing */
     43: struct _n_SR {
     44:   PetscReal     int0,int1;    /* Extremes of the interval */
     45:   PetscInt      dir;          /* Determines the order of values in eig (+1 incr, -1 decr) */
     46:   PetscBool     hasEnd;       /* Tells whether the interval has an end */
     47:   PetscInt      inertia0,inertia1;
     48:   PetscScalar   *back;
     49:   PetscInt      numEigs;      /* Number of eigenvalues in the interval */
     50:   PetscInt      indexEig;
     51:   EPS_shift     sPres;        /* Present shift */
     52:   EPS_shift     *pending;     /* Pending shifts array */
     53:   PetscInt      nPend;        /* Number of pending shifts */
     54:   PetscInt      maxPend;      /* Size of "pending" array */
     55:   PetscInt      *idxDef;      /* For deflation */
     56:   PetscInt      nMAXCompl;
     57:   PetscInt      iterCompl;
     58:   PetscInt      itsKs;        /* Krylovschur restarts */
     59:   PetscInt      nleap;
     60:   EPS_shift     s0;           /* Initial shift */
     61:   PetscScalar   *S;           /* Matrix for projected problem */
     62:   PetscInt      nS;
     63:   EPS_shift     sPrev;
     64:   PetscInt      nv;           /* position of restart vector */
     65:   BV            V;            /* working basis (for subsolve) */
     66:   BV            Vnext;        /* temporary working basis during change of shift */
     67:   PetscScalar   *eigr,*eigi;  /* eigenvalues (for subsolve) */
     68:   PetscReal     *errest;      /* error estimates (for subsolve) */
     69:   PetscInt      *perm;        /* permutation (for subsolve) */
     70: };
     71: typedef struct _n_SR *EPS_SR;

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

    102: #endif