Date: 2021-09-20T09:44:15+00:00

Actual source code: slepcds.h
slepc-3.15.2 2021-09-20
Report Typos and Errors

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-2021, 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:    User interface for the direct solver object in SLEPc
     12: */

     14: #if !defined(SLEPCDS_H)
     15: #define SLEPCDS_H
     16: #include <slepcsc.h>
     17: #include <slepcfn.h>

     19: #define DS_MAX_SOLVE 6

     21: SLEPC_EXTERN PetscErrorCode DSInitializePackage(void);
     22: /*S
     23:     DS - Direct solver (or dense system), to represent low-dimensional
     24:     eigenproblems that must be solved within iterative solvers. This is an
     25:     auxiliary object and is not normally needed by application programmers.

     27:     Level: beginner

     29: .seealso:  DSCreate()
     30: S*/
     31: typedef struct _p_DS* DS;

     33: /*J
     34:     DSType - String with the name of the type of direct solver. Roughly,
     35:     there are as many types as problem types are available within SLEPc.

     37:     Level: advanced

     39: .seealso: DSSetType(), DS
     40: J*/
     41: typedef const char* DSType;
     42: #define DSHEP    "hep"
     43: #define DSNHEP   "nhep"
     44: #define DSGHEP   "ghep"
     45: #define DSGHIEP  "ghiep"
     46: #define DSGNHEP  "gnhep"
     47: #define DSNHEPTS "nhepts"
     48: #define DSSVD    "svd"
     49: #define DSPEP    "pep"
     50: #define DSNEP    "nep"

     52: /* Logging support */
     53: SLEPC_EXTERN PetscClassId DS_CLASSID;

     55: /*E
     56:     DSStateType - Indicates in which state the direct solver is

     58:     Level: advanced

     60: .seealso: DSSetState()
     61: E*/
     62: typedef enum { DS_STATE_RAW,
     63:                DS_STATE_INTERMEDIATE,
     64:                DS_STATE_CONDENSED,
     65:                DS_STATE_TRUNCATED } DSStateType;
     66: SLEPC_EXTERN const char *DSStateTypes[];

     68: /*E
     69:     DSMatType - Used to refer to one of the matrices stored internally in DS

     71:     Notes:
     72:     The matrices preferently refer to
     73: +   DS_MAT_A  - first matrix of eigenproblem/singular value problem
     74: .   DS_MAT_B  - second matrix of a generalized eigenproblem
     75: .   DS_MAT_C  - third matrix of a quadratic eigenproblem
     76: .   DS_MAT_T  - tridiagonal matrix
     77: .   DS_MAT_D  - diagonal matrix
     78: .   DS_MAT_Q  - orthogonal matrix of (right) Schur vectors
     79: .   DS_MAT_Z  - orthogonal matrix of left Schur vectors
     80: .   DS_MAT_X  - right eigenvectors
     81: .   DS_MAT_Y  - left eigenvectors
     82: .   DS_MAT_U  - left singular vectors
     83: .   DS_MAT_VT - right singular vectors
     84: .   DS_MAT_W  - workspace matrix
     85: -   DS_MAT_Ex - extra matrices (x=0,..,9)

     87:     All matrices can have space to hold ld x ld elements, except for
     88:     DS_MAT_T that has space for 3 x ld elements (ld = leading dimension)
     89:     and DS_MAT_D that has space for just ld elements.

     91:     In DSPEP problems, matrices A, B, W can have space for d*ld x d*ld,
     92:     where d is the polynomial degree, and X can have ld x d*ld.

     94:     Level: advanced

     96: .seealso: DSAllocate(), DSGetArray(), DSGetArrayReal(), DSVectors()
     97: E*/
     98: typedef enum { DS_MAT_A,
     99:                DS_MAT_B,
    100:                DS_MAT_C,
    101:                DS_MAT_T,
    102:                DS_MAT_D,
    103:                DS_MAT_Q,
    104:                DS_MAT_Z,
    105:                DS_MAT_X,
    106:                DS_MAT_Y,
    107:                DS_MAT_U,
    108:                DS_MAT_VT,
    109:                DS_MAT_W,
    110:                DS_MAT_E0,
    111:                DS_MAT_E1,
    112:                DS_MAT_E2,
    113:                DS_MAT_E3,
    114:                DS_MAT_E4,
    115:                DS_MAT_E5,
    116:                DS_MAT_E6,
    117:                DS_MAT_E7,
    118:                DS_MAT_E8,
    119:                DS_MAT_E9,
    120:                DS_NUM_MAT } DSMatType;

    122: /* Convenience for indexing extra matrices */
    123: SLEPC_EXTERN DSMatType DSMatExtra[];
    124: #define DS_NUM_EXTRA  10

    126: /*E
    127:     DSParallelType - Indicates the parallel mode that the direct solver will use

    129:     Level: advanced

    131: .seealso: DSSetParallel()
    132: E*/
    133: typedef enum { DS_PARALLEL_REDUNDANT,
    134:                DS_PARALLEL_SYNCHRONIZED } DSParallelType;
    135: SLEPC_EXTERN const char *DSParallelTypes[];

    137: SLEPC_EXTERN PetscErrorCode DSCreate(MPI_Comm,DS*);
    138: SLEPC_EXTERN PetscErrorCode DSSetType(DS,DSType);
    139: SLEPC_EXTERN PetscErrorCode DSGetType(DS,DSType*);
    140: SLEPC_EXTERN PetscErrorCode DSSetOptionsPrefix(DS,const char *);
    141: SLEPC_EXTERN PetscErrorCode DSAppendOptionsPrefix(DS,const char *);
    142: SLEPC_EXTERN PetscErrorCode DSGetOptionsPrefix(DS,const char *[]);
    143: SLEPC_EXTERN PetscErrorCode DSSetFromOptions(DS);
    144: SLEPC_EXTERN PetscErrorCode DSView(DS,PetscViewer);
    145: SLEPC_EXTERN PetscErrorCode DSViewFromOptions(DS,PetscObject,const char[]);
    146: SLEPC_EXTERN PetscErrorCode DSViewMat(DS,PetscViewer,DSMatType);
    147: SLEPC_EXTERN PetscErrorCode DSDestroy(DS*);
    148: SLEPC_EXTERN PetscErrorCode DSReset(DS);
    149: SLEPC_EXTERN PetscErrorCode DSDuplicate(DS,DS*);

    151: SLEPC_EXTERN PetscErrorCode DSAllocate(DS,PetscInt);
    152: SLEPC_EXTERN PetscErrorCode DSGetLeadingDimension(DS,PetscInt*);
    153: SLEPC_EXTERN PetscErrorCode DSSetState(DS,DSStateType);
    154: SLEPC_EXTERN PetscErrorCode DSGetState(DS,DSStateType*);
    155: SLEPC_EXTERN PetscErrorCode DSSetDimensions(DS,PetscInt,PetscInt,PetscInt,PetscInt);
    156: SLEPC_EXTERN PetscErrorCode DSGetDimensions(DS,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
    157: SLEPC_EXTERN PetscErrorCode DSSetBlockSize(DS,PetscInt);
    158: SLEPC_EXTERN PetscErrorCode DSGetBlockSize(DS,PetscInt*);
    159: SLEPC_EXTERN PetscErrorCode DSGetTruncateSize(DS,PetscInt,PetscInt,PetscInt*);
    160: SLEPC_EXTERN PetscErrorCode DSTruncate(DS,PetscInt,PetscBool);
    161: SLEPC_EXTERN PetscErrorCode DSSetIdentity(DS,DSMatType);
    162: SLEPC_EXTERN PetscErrorCode DSSetMethod(DS,PetscInt);
    163: SLEPC_EXTERN PetscErrorCode DSGetMethod(DS,PetscInt*);
    164: SLEPC_EXTERN PetscErrorCode DSSetParallel(DS,DSParallelType);
    165: SLEPC_EXTERN PetscErrorCode DSGetParallel(DS,DSParallelType*);
    166: SLEPC_EXTERN PetscErrorCode DSSetCompact(DS,PetscBool);
    167: SLEPC_EXTERN PetscErrorCode DSGetCompact(DS,PetscBool*);
    168: SLEPC_EXTERN PetscErrorCode DSSetExtraRow(DS,PetscBool);
    169: SLEPC_EXTERN PetscErrorCode DSGetExtraRow(DS,PetscBool*);
    170: SLEPC_EXTERN PetscErrorCode DSSetRefined(DS,PetscBool);
    171: SLEPC_EXTERN PetscErrorCode DSGetRefined(DS,PetscBool*);
    172: SLEPC_EXTERN PetscErrorCode DSGetMat(DS,DSMatType,Mat*);
    173: SLEPC_EXTERN PetscErrorCode DSRestoreMat(DS,DSMatType,Mat*);
    174: SLEPC_EXTERN PetscErrorCode DSGetArray(DS,DSMatType,PetscScalar*[]);
    175: SLEPC_EXTERN PetscErrorCode DSRestoreArray(DS,DSMatType,PetscScalar*[]);
    176: SLEPC_EXTERN PetscErrorCode DSGetArrayReal(DS,DSMatType,PetscReal*[]);
    177: SLEPC_EXTERN PetscErrorCode DSRestoreArrayReal(DS,DSMatType,PetscReal*[]);
    178: SLEPC_EXTERN PetscErrorCode DSVectors(DS,DSMatType,PetscInt*,PetscReal*);
    179: SLEPC_EXTERN PetscErrorCode DSSolve(DS,PetscScalar*,PetscScalar*);
    180: SLEPC_EXTERN PetscErrorCode DSSort(DS,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*);
    181: SLEPC_EXTERN PetscErrorCode DSSortWithPermutation(DS,PetscInt*,PetscScalar*,PetscScalar*);
    182: SLEPC_EXTERN PetscErrorCode DSSynchronize(DS,PetscScalar*,PetscScalar*);
    183: SLEPC_EXTERN PetscErrorCode DSCopyMat(DS,DSMatType,PetscInt,PetscInt,Mat,PetscInt,PetscInt,PetscInt,PetscInt,PetscBool);
    184: SLEPC_EXTERN PetscErrorCode DSMatGetSize(DS,DSMatType,PetscInt*,PetscInt*);
    185: SLEPC_EXTERN PetscErrorCode DSMatIsHermitian(DS,DSMatType,PetscBool*);
    186: SLEPC_EXTERN PetscErrorCode DSSetSlepcSC(DS,SlepcSC);
    187: SLEPC_EXTERN PetscErrorCode DSGetSlepcSC(DS,SlepcSC*);
    188: SLEPC_EXTERN PetscErrorCode DSUpdateExtraRow(DS);
    189: SLEPC_EXTERN PetscErrorCode DSCond(DS,PetscReal*);
    190: SLEPC_EXTERN PetscErrorCode DSTranslateHarmonic(DS,PetscScalar,PetscReal,PetscBool,PetscScalar*,PetscReal*);
    191: SLEPC_EXTERN PetscErrorCode DSTranslateRKS(DS,PetscScalar);
    192: SLEPC_EXTERN PetscErrorCode DSOrthogonalize(DS,DSMatType,PetscInt,PetscInt*);
    193: SLEPC_EXTERN PetscErrorCode DSPseudoOrthogonalize(DS,DSMatType,PetscInt,PetscReal*,PetscInt*,PetscReal*);

    195: /* --------- options specific to particular solvers -------- */

    197: SLEPC_EXTERN PetscErrorCode DSPEPSetDegree(DS,PetscInt);
    198: SLEPC_EXTERN PetscErrorCode DSPEPGetDegree(DS,PetscInt*);
    199: SLEPC_EXTERN PetscErrorCode DSPEPSetCoefficients(DS,PetscReal*);
    200: SLEPC_EXTERN PetscErrorCode DSPEPGetCoefficients(DS,PetscReal**);

    202: SLEPC_EXTERN PetscErrorCode DSNEPSetFN(DS,PetscInt,FN*);
    203: SLEPC_EXTERN PetscErrorCode DSNEPGetFN(DS,PetscInt,FN*);
    204: SLEPC_EXTERN PetscErrorCode DSNEPGetNumFN(DS,PetscInt*);
    205: SLEPC_EXTERN PetscErrorCode DSNEPSetComputeMatrixFunction(DS,PetscErrorCode (*fun)(DS,PetscScalar,PetscBool,DSMatType,void*),void *ctx);

    207: SLEPC_EXTERN PetscFunctionList DSList;
    208: SLEPC_EXTERN PetscErrorCode DSRegister(const char[],PetscErrorCode(*)(DS));

    210: #endif