Date: 2022-08-09T09:05:54+00:00

Actual source code: nepdefl.h
slepc-3.17.2 2022-08-09
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 Deflation in NEP
     12: */
     13: #if !defined(SLEPC_NEPDEFL_H)
     14: #define SLEPC_NEPDEFL_H

     16: # define MAX_MINIDX 1

     18: typedef struct _n_nep_ext_op *NEP_EXT_OP;
     19: typedef struct _n_nep_def_fun_solve *NEP_DEF_FUN_SOLVE;
     20: typedef struct _n_nep_def_project *NEP_DEF_PROJECT;

     22: /* Structure characterizing a deflation context */
     23: struct _n_nep_ext_op {
     24:   NEP               nep;
     25:   PetscScalar       *H;     /* invariant pair (X,H) */
     26:   BV                X;      /* locked eigenvectors */
     27:   PetscScalar       *bc;    /* polinomial basis roots */
     28:   RG                rg;
     29:   PetscInt          midx;   /* minimality index */
     30:   PetscInt          max_midx;
     31:   PetscInt          szd;    /* maximum size for deflation */
     32:   PetscInt          n;      /* invariant pair size */
     33:   PetscBool         ref;    /* refine with original size */
     34:   Mat               MF;     /* function shell matrix */
     35:   Mat               MJ;     /* Jacobian shell matrix */
     36:   PetscBool         simpU;  /* the way U is computed */
     37:   NEP_DEF_FUN_SOLVE solve;  /* MatSolve context for the operator */
     38:   NEP_DEF_PROJECT   proj;   /* context for the projected eigenproblem */
     39:   /* auxiliary computations */
     40:   BV                W;
     41:   PetscScalar       *Hj;    /* matrix containing the powers of the invariant pair matrix */
     42:   PetscScalar       *XpX;   /* X^*X */
     43:   DS                ds;
     44:   Vec               w;
     45: };

     47: struct _n_nep_def_fun_solve {
     48:   KSP          ksp;   /* */
     49:   PetscBool    sincf;
     50:   Mat          T;
     51:   PetscScalar  theta;
     52:   PetscInt     n;
     53:   PetscScalar  *M;
     54:   PetscScalar  *work;
     55:   Vec          w[2];
     56:   BV           T_1U;
     57:   NEP_EXT_OP   extop;
     58: };

     60: typedef struct {
     61:   NEP          nep;
     62:   Mat          T;
     63:   Mat          P;
     64:   BV           U;
     65:   PetscScalar  *A;
     66:   PetscScalar  *B;
     67:   PetscScalar  theta;
     68:   PetscInt     n;
     69:   NEP_EXT_OP   extop;
     70:   PetscBool    jacob;
     71:   Vec          w[2];
     72:   PetscScalar  *work;
     73:   PetscScalar  *hfj;
     74:   PetscScalar  *hfjp;
     75:   PetscBool    hfjset;
     76: } NEP_DEF_MATSHELL;

     78: struct _n_nep_def_project {
     79:   Mat          *V1pApX;
     80:   Mat          XpV1;
     81:   PetscScalar  *V2;
     82:   Vec          w;
     83:   BV           V1;
     84:   PetscInt     dim;
     85:   PetscScalar  *work;
     86:   PetscInt     lwork;
     87:   NEP_EXT_OP   extop;
     88: };

     90: #if 0
     91: typedef struct {
     92:   PC          pc;      /* basic preconditioner */
     93:   PetscScalar *M;
     94:   PetscScalar *ps;
     95:   PetscInt    ld;
     96:   Vec         *work;
     97:   BV          X;
     98:   PetscInt    n;
     99: } NEP_DEF_PCSHELL;
    100: #endif
    101: #endif

    103: SLEPC_INTERN PetscErrorCode NEPDeflationCopyToExtendedVec(NEP_EXT_OP,Vec,PetscScalar*,Vec,PetscBool);
    104: SLEPC_INTERN PetscErrorCode NEPDeflationReset(NEP_EXT_OP);
    105: SLEPC_INTERN PetscErrorCode NEPDeflationInitialize(NEP,BV,KSP,PetscBool,PetscInt,NEP_EXT_OP*);
    106: SLEPC_INTERN PetscErrorCode NEPDeflationCreateVec(NEP_EXT_OP,Vec*);
    107: SLEPC_INTERN PetscErrorCode NEPDeflationComputeFunction(NEP_EXT_OP,PetscScalar,Mat*);
    108: SLEPC_INTERN PetscErrorCode NEPDeflationComputeJacobian(NEP_EXT_OP,PetscScalar,Mat*);
    109: SLEPC_INTERN PetscErrorCode NEPDeflationSolveSetUp(NEP_EXT_OP,PetscScalar);
    110: SLEPC_INTERN PetscErrorCode NEPDeflationFunctionSolve(NEP_EXT_OP,Vec,Vec);
    111: SLEPC_INTERN PetscErrorCode NEPDeflationGetInvariantPair(NEP_EXT_OP,BV*,Mat*);
    112: SLEPC_INTERN PetscErrorCode NEPDeflationLocking(NEP_EXT_OP,Vec,PetscScalar);
    113: SLEPC_INTERN PetscErrorCode NEPDeflationSetRandomVec(NEP_EXT_OP,Vec);
    114: SLEPC_INTERN PetscErrorCode NEPDeflationProjectOperator(NEP_EXT_OP,BV,DS,PetscInt,PetscInt);
    115: SLEPC_INTERN PetscErrorCode NEPDeflationCreateBV(NEP_EXT_OP,PetscInt,BV*);
    116: SLEPC_INTERN PetscErrorCode NEPDeflationSetRefine(NEP_EXT_OP,PetscBool);
    117: SLEPC_INTERN PetscErrorCode NEPDeflationExtractEigenpair(NEP_EXT_OP,PetscInt,Vec,PetscScalar,DS);