Actual source code: pepkrylov.h

slepc-3.21.1 2024-04-26
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: #pragma once

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

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

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

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

 49: /* Structure for storing the state of spectrum slicing */
 50: struct _n_SR {
 51:   PetscReal     int0,int1;         /* Extremes of the interval */
 52:   PetscInt      dir;               /* Determines the order of values in eig (+1 incr, -1 decr) */
 53:   PetscBool     hasEnd;            /* Tells whether the interval has an end */
 54:   PetscBool     dirch;             /* Tells if dir has been changed */
 55:   PetscInt      inertia0,inertia1;
 56:   PetscScalar   *back;
 57:   PetscInt      numEigs;           /* Number of eigenvalues in the interval */
 58:   PetscInt      indexEig;
 59:   PEP_shift     sPres;             /* Present shift */
 60:   PEP_shift     *pending;          /* Pending shifts array */
 61:   PetscInt      nPend;             /* Number of pending shifts */
 62:   PetscInt      maxPend;           /* Size of "pending" array */
 63:   PetscInt      *idxDef0,*idxDef1; /* For deflation */
 64:   PetscInt      ndef0,ndef1;       /* Index in deflation arrays */
 65:   PetscInt      nMAXCompl;
 66:   PetscInt      iterCompl;
 67:   PetscInt      itsKs;             /* Krylovschur restarts */
 68:   PetscInt      nleap;
 69:   PEP_shift     s0;                /* Initial shift */
 70:   PEP_shift     sPrev;
 71:   PetscInt      nv;                /* position of restart vector */
 72:   BV            V;                 /* full TOAR basis */
 73:   PetscScalar   *S;                /* TOAR coefficients */
 74:   PetscInt      ld;                /* Leading dimension for each block of S */
 75:   BV            Vnext;             /* temporary working basis during change of shift */
 76:   PetscScalar   *eigr,*eigi;       /* eigenvalues */
 77:   PetscReal     *errest;           /* error estimates */
 78:   PetscInt      *perm;             /* permutation */
 79:   PEP_QInfo     *qinfo;            /* TOAR vectors for each eigenvector */
 80:   PetscInt      intcorr;           /* Global inertia correction */
 81:   PetscInt      type;              /* Global type of eigenvalues in general case */
 82:   PetscInt      symmlost;          /* Counter for symmetry lost */
 83:   Vec           v[3];
 84:   EPS           eps;
 85:   PetscReal     mu;
 86: };
 87: typedef struct _n_SR *PEP_SR;

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