Date: 2023-09-05T10:18:25+00:00

Actual source code: pepkrylov.h
slepc-3.19.2 2023-09-05
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 TOAR and STOAR
     12: */

     14: #if !defined(SLEPC_PEPKRYLOV_H)
     15: #define SLEPC_PEPKRYLOV_H

     17: SLEPC_INTERN PetscErrorCode PEPExtractVectors_TOAR(PEP);
     18: SLEPC_INTERN PetscErrorCode PEPSTOARSetUpInnerMatrix(PEP,Mat*);
     19: SLEPC_INTERN PetscErrorCode PEPSolve_STOAR(PEP);
     20: SLEPC_INTERN PetscErrorCode PEPSolve_STOAR_QSlice(PEP);
     21: SLEPC_INTERN PetscErrorCode PEPSetUp_STOAR_QSlice(PEP);
     22: SLEPC_INTERN PetscErrorCode PEPReset_STOAR_QSlice(PEP);

     24: typedef struct {
     25:   PetscReal     keep;         /* restart parameter */
     26:   PetscBool     lock;         /* locking/non-locking variant */
     27:   BV            V;            /* tensor basis vectors object for the linearization */
     28: } PEP_TOAR;

     30: /* Structure characterizing a shift in spectrum slicing */
     31: typedef struct _n_shift *PEP_shift;
     32: struct _n_shift {
     33:   PetscReal     value;
     34:   PetscInt      inertia;
     35:   PetscBool     comp[2];      /* Shows completion of subintervals (left and right) */
     36:   PEP_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: };

     44: /* Identifies the TOAR vectors for each eigenvector in the global array */
     45: typedef struct {
     46:   PetscInt      nq;
     47:   PetscInt      *q;
     48: } PEP_QInfo;

     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:   PetscBool     dirch;             /* Tells if dir has been changed */
     56:   PetscInt      inertia0,inertia1;
     57:   PetscScalar   *back;
     58:   PetscInt      numEigs;           /* Number of eigenvalues in the interval */
     59:   PetscInt      indexEig;
     60:   PEP_shift     sPres;             /* Present shift */
     61:   PEP_shift     *pending;          /* Pending shifts array */
     62:   PetscInt      nPend;             /* Number of pending shifts */
     63:   PetscInt      maxPend;           /* Size of "pending" array */
     64:   PetscInt      *idxDef0,*idxDef1; /* For deflation */
     65:   PetscInt      ndef0,ndef1;       /* Index in deflation arrays */
     66:   PetscInt      nMAXCompl;
     67:   PetscInt      iterCompl;
     68:   PetscInt      itsKs;             /* Krylovschur restarts */
     69:   PetscInt      nleap;
     70:   PEP_shift     s0;                /* Initial shift */
     71:   PEP_shift     sPrev;
     72:   PetscInt      nv;                /* position of restart vector */
     73:   BV            V;                 /* full TOAR basis */
     74:   PetscScalar   *S;                /* TOAR coefficients */
     75:   PetscInt      ld;                /* Leading dimension for each block of S */
     76:   BV            Vnext;             /* temporary working basis during change of shift */
     77:   PetscScalar   *eigr,*eigi;       /* eigenvalues */
     78:   PetscReal     *errest;           /* error estimates */
     79:   PetscInt      *perm;             /* permutation */
     80:   PEP_QInfo     *qinfo;            /* TOAR vectors for each eigenvector */
     81:   PetscInt      intcorr;           /* Global inertia correction */
     82:   PetscInt      type;              /* Global type of eigenvalues in general case */
     83:   PetscInt      symmlost;          /* Counter for symmetry lost */
     84:   Vec           v[3];
     85:   EPS           eps;
     86:   PetscReal     mu;
     87: };
     88: typedef struct _n_SR *PEP_SR;

     90: typedef struct {
     91:   PetscReal     keep;           /* restart parameter */
     92:   PetscBool     lock;           /* locking/non-locking variant */
     93:   BV            V;              /* tensor basis vectors object for the linearization */
     94:   PEP_SR        sr;             /* spectrum slicing context */
     95:   PetscReal     *shifts;        /* array containing global shifts */
     96:   PetscInt      *inertias;      /* array containing global inertias */
     97:   PetscInt      nshifts;        /* elements in the arrays of shifts and inertias */
     98:   PetscInt      nev;            /* number of eigenvalues to compute */
     99:   PetscInt      ncv;            /* number of basis vectors */
    100:   PetscInt      mpd;            /* maximum dimension of projected problem */
    101:   PetscBool     detect;         /* check for zeros during factorizations */
    102:   PetscBool     hyperbolic;     /* hyperbolic problem flag */
    103:   PetscReal     alpha,beta;     /* coefficients defining the linearization */
    104:   PetscBool     checket;        /* check eigenvalue type during spectrum slicing */
    105: } PEP_STOAR;

    107: #endif