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 EPSGetArbitraryValues(EPS,PetscScalar*,PetscScalar*);
     30: SLEPC_INTERN PetscErrorCode EPSKrylovSchurGetChildEPS(EPS,EPS*);

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

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

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