Date: 2022-03-31T15:29:41+00:00

Actual source code: slepcbv.h
slepc-3.17.0 2022-03-31
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:    User interface for the basis vectors object in SLEPc
     12: */

     14: #if !defined(SLEPCBV_H)
     15: #define SLEPCBV_H
     16: #include <slepcsys.h>

     18: SLEPC_EXTERN PetscErrorCode BVInitializePackage(void);

     20: /*S
     21:     BV - Basis vectors, SLEPc object representing a collection of vectors
     22:     that typically constitute a basis of a subspace.

     24:     Level: beginner

     26: .seealso:  BVCreate()
     27: S*/
     28: typedef struct _p_BV* BV;

     30: /*J
     31:     BVType - String with the name of the type of BV. Each type differs in
     32:     the way data is stored internally.

     34:     Level: beginner

     36: .seealso: BVSetType(), BV
     37: J*/
     38: typedef const char* BVType;
     39: #define BVMAT        "mat"
     40: #define BVSVEC       "svec"
     41: #define BVVECS       "vecs"
     42: #define BVCONTIGUOUS "contiguous"
     43: #define BVTENSOR     "tensor"

     45: /* Logging support */
     46: SLEPC_EXTERN PetscClassId BV_CLASSID;

     48: /*E
     49:     BVOrthogType - Determines the method used in the orthogonalization
     50:     of vectors

     52:     Level: advanced

     54: .seealso: BVSetOrthogonalization(), BVGetOrthogonalization(), BVOrthogonalizeColumn(), BVOrthogRefineType
     55: E*/
     56: typedef enum { BV_ORTHOG_CGS,
     57:                BV_ORTHOG_MGS } BVOrthogType;
     58: SLEPC_EXTERN const char *BVOrthogTypes[];

     60: /*E
     61:     BVOrthogRefineType - Determines what type of refinement to use
     62:     during orthogonalization of vectors

     64:     Level: advanced

     66: .seealso: BVSetOrthogonalization(), BVGetOrthogonalization(), BVOrthogonalizeColumn()
     67: E*/
     68: typedef enum { BV_ORTHOG_REFINE_IFNEEDED,
     69:                BV_ORTHOG_REFINE_NEVER,
     70:                BV_ORTHOG_REFINE_ALWAYS } BVOrthogRefineType;
     71: SLEPC_EXTERN const char *BVOrthogRefineTypes[];

     73: /*E
     74:     BVOrthogBlockType - Determines the method used in block
     75:     orthogonalization (simultaneous orthogonalization of a set of vectors)

     77:     Level: advanced

     79: .seealso: BVSetOrthogonalization(), BVGetOrthogonalization(), BVOrthogonalize()
     80: E*/
     81: typedef enum { BV_ORTHOG_BLOCK_GS,
     82:                BV_ORTHOG_BLOCK_CHOL,
     83:                BV_ORTHOG_BLOCK_TSQR,
     84:                BV_ORTHOG_BLOCK_TSQRCHOL,
     85:                BV_ORTHOG_BLOCK_SVQB     } BVOrthogBlockType;
     86: SLEPC_EXTERN const char *BVOrthogBlockTypes[];

     88: /*E
     89:    BVMatMultType - Different ways of performing the BVMatMult() operation

     91:    Notes:
     92:    Allowed values are
     93: +  BV_MATMULT_VECS - perform a matrix-vector multiply per each column
     94: .  BV_MATMULT_MAT - carry out a Mat-Mat product with a dense matrix
     95: -  BV_MATMULT_MAT_SAVE - this case is deprecated

     97:    The default is BV_MATMULT_MAT except in the case of BVVECS.

     99:    Level: advanced

    101: .seealso: BVSetMatMultMethod(), BVMatMult()
    102: E*/
    103: typedef enum { BV_MATMULT_VECS,
    104:                BV_MATMULT_MAT,
    105:                BV_MATMULT_MAT_SAVE } BVMatMultType;
    106: SLEPC_EXTERN const char *BVMatMultTypes[];

    108: SLEPC_EXTERN PetscErrorCode BVCreate(MPI_Comm,BV*);
    109: SLEPC_EXTERN PetscErrorCode BVDestroy(BV*);
    110: SLEPC_EXTERN PetscErrorCode BVSetType(BV,BVType);
    111: SLEPC_EXTERN PetscErrorCode BVGetType(BV,BVType*);
    112: SLEPC_EXTERN PetscErrorCode BVSetSizes(BV,PetscInt,PetscInt,PetscInt);
    113: SLEPC_EXTERN PetscErrorCode BVSetSizesFromVec(BV,Vec,PetscInt);
    114: SLEPC_EXTERN PetscErrorCode BVGetSizes(BV,PetscInt*,PetscInt*,PetscInt*);
    115: SLEPC_EXTERN PetscErrorCode BVResize(BV,PetscInt,PetscBool);
    116: SLEPC_EXTERN PetscErrorCode BVSetFromOptions(BV);
    117: SLEPC_EXTERN PetscErrorCode BVView(BV,PetscViewer);
    118: SLEPC_EXTERN PetscErrorCode BVViewFromOptions(BV,PetscObject,const char[]);

    120: SLEPC_EXTERN PetscErrorCode BVGetColumn(BV,PetscInt,Vec*);
    121: SLEPC_EXTERN PetscErrorCode BVRestoreColumn(BV,PetscInt,Vec*);
    122: SLEPC_EXTERN PetscErrorCode BVGetSplit(BV,BV*,BV*);
    123: SLEPC_EXTERN PetscErrorCode BVRestoreSplit(BV,BV*,BV*);
    124: SLEPC_EXTERN PetscErrorCode BVGetArray(BV,PetscScalar**);
    125: SLEPC_EXTERN PetscErrorCode BVRestoreArray(BV,PetscScalar**);
    126: SLEPC_EXTERN PetscErrorCode BVGetArrayRead(BV,const PetscScalar**);
    127: SLEPC_EXTERN PetscErrorCode BVRestoreArrayRead(BV,const PetscScalar**);
    128: SLEPC_EXTERN PetscErrorCode BVCreateVec(BV,Vec*);
    129: SLEPC_EXTERN PetscErrorCode BVSetActiveColumns(BV,PetscInt,PetscInt);
    130: SLEPC_EXTERN PetscErrorCode BVGetActiveColumns(BV,PetscInt*,PetscInt*);
    131: SLEPC_EXTERN PetscErrorCode BVInsertVec(BV,PetscInt,Vec);
    132: SLEPC_EXTERN PetscErrorCode BVInsertVecs(BV,PetscInt,PetscInt*,Vec*,PetscBool);
    133: SLEPC_EXTERN PetscErrorCode BVInsertConstraints(BV,PetscInt*,Vec*);
    134: SLEPC_EXTERN PetscErrorCode BVSetNumConstraints(BV,PetscInt);
    135: SLEPC_EXTERN PetscErrorCode BVGetNumConstraints(BV,PetscInt*);
    136: SLEPC_EXTERN PetscErrorCode BVSetDefiniteTolerance(BV,PetscReal);
    137: SLEPC_EXTERN PetscErrorCode BVGetDefiniteTolerance(BV,PetscReal*);
    138: SLEPC_EXTERN PetscErrorCode BVDuplicate(BV,BV*);
    139: SLEPC_EXTERN PetscErrorCode BVDuplicateResize(BV,PetscInt,BV*);
    140: SLEPC_EXTERN PetscErrorCode BVCopy(BV,BV);
    141: SLEPC_EXTERN PetscErrorCode BVCopyVec(BV,PetscInt,Vec);
    142: SLEPC_EXTERN PetscErrorCode BVCopyColumn(BV,PetscInt,PetscInt);
    143: SLEPC_EXTERN PetscErrorCode BVSetMatrix(BV,Mat,PetscBool);
    144: SLEPC_EXTERN PetscErrorCode BVGetMatrix(BV,Mat*,PetscBool*);
    145: SLEPC_EXTERN PetscErrorCode BVApplyMatrix(BV,Vec,Vec);
    146: SLEPC_EXTERN PetscErrorCode BVApplyMatrixBV(BV,BV);
    147: SLEPC_EXTERN PetscErrorCode BVGetCachedBV(BV,BV*);
    148: SLEPC_EXTERN PetscErrorCode BVSetSignature(BV,Vec);
    149: SLEPC_EXTERN PetscErrorCode BVGetSignature(BV,Vec);
    150: SLEPC_EXTERN PetscErrorCode BVSetBufferVec(BV,Vec);
    151: SLEPC_EXTERN PetscErrorCode BVGetBufferVec(BV,Vec*);

    153: SLEPC_EXTERN PetscErrorCode BVMult(BV,PetscScalar,PetscScalar,BV,Mat);
    154: SLEPC_EXTERN PetscErrorCode BVMultVec(BV,PetscScalar,PetscScalar,Vec,PetscScalar*);
    155: SLEPC_EXTERN PetscErrorCode BVMultColumn(BV,PetscScalar,PetscScalar,PetscInt,PetscScalar*);
    156: SLEPC_EXTERN PetscErrorCode BVMultInPlace(BV,Mat,PetscInt,PetscInt);
    157: SLEPC_EXTERN PetscErrorCode BVMultInPlaceHermitianTranspose(BV,Mat,PetscInt,PetscInt);
    158: PETSC_DEPRECATED_FUNCTION("Use BVMultInPlaceHermitianTranspose()") static inline PetscErrorCode BVMultInPlaceTranspose(BV bv,Mat A,PetscInt s,PetscInt e) {return BVMultInPlaceHermitianTranspose(bv,A,s,e);}
    159: SLEPC_EXTERN PetscErrorCode BVMatMult(BV,Mat,BV);
    160: SLEPC_EXTERN PetscErrorCode BVMatMultTranspose(BV,Mat,BV);
    161: SLEPC_EXTERN PetscErrorCode BVMatMultHermitianTranspose(BV,Mat,BV);
    162: SLEPC_EXTERN PetscErrorCode BVMatMultColumn(BV,Mat,PetscInt);
    163: SLEPC_EXTERN PetscErrorCode BVMatMultTransposeColumn(BV,Mat,PetscInt);
    164: SLEPC_EXTERN PetscErrorCode BVMatMultHermitianTransposeColumn(BV,Mat,PetscInt);
    165: SLEPC_EXTERN PetscErrorCode BVMatProject(BV,Mat,BV,Mat);
    166: SLEPC_EXTERN PetscErrorCode BVMatArnoldi(BV,Mat,Mat,PetscInt,PetscInt*,PetscReal*,PetscBool*);
    167: SLEPC_EXTERN PetscErrorCode BVMatLanczos(BV,Mat,PetscReal*,PetscReal*,PetscInt,PetscInt*,PetscBool*);

    169: SLEPC_EXTERN PetscErrorCode BVDot(BV,BV,Mat);
    170: SLEPC_EXTERN PetscErrorCode BVDotVec(BV,Vec,PetscScalar*);
    171: SLEPC_EXTERN PetscErrorCode BVDotVecBegin(BV,Vec,PetscScalar*);
    172: SLEPC_EXTERN PetscErrorCode BVDotVecEnd(BV,Vec,PetscScalar*);
    173: SLEPC_EXTERN PetscErrorCode BVDotColumn(BV,PetscInt,PetscScalar*);
    174: SLEPC_EXTERN PetscErrorCode BVDotColumnBegin(BV,PetscInt,PetscScalar*);
    175: SLEPC_EXTERN PetscErrorCode BVDotColumnEnd(BV,PetscInt,PetscScalar*);
    176: SLEPC_EXTERN PetscErrorCode BVScale(BV,PetscScalar);
    177: SLEPC_EXTERN PetscErrorCode BVScaleColumn(BV,PetscInt,PetscScalar);
    178: SLEPC_EXTERN PetscErrorCode BVNorm(BV,NormType,PetscReal*);
    179: SLEPC_EXTERN PetscErrorCode BVNormVec(BV,Vec,NormType,PetscReal*);
    180: SLEPC_EXTERN PetscErrorCode BVNormVecBegin(BV,Vec,NormType,PetscReal*);
    181: SLEPC_EXTERN PetscErrorCode BVNormVecEnd(BV,Vec,NormType,PetscReal*);
    182: SLEPC_EXTERN PetscErrorCode BVNormColumn(BV,PetscInt,NormType,PetscReal*);
    183: SLEPC_EXTERN PetscErrorCode BVNormColumnBegin(BV,PetscInt,NormType,PetscReal*);
    184: SLEPC_EXTERN PetscErrorCode BVNormColumnEnd(BV,PetscInt,NormType,PetscReal*);
    185: SLEPC_EXTERN PetscErrorCode BVNormalize(BV,PetscScalar*);
    186: SLEPC_EXTERN PetscErrorCode BVSetRandom(BV);
    187: SLEPC_EXTERN PetscErrorCode BVSetRandomNormal(BV);
    188: SLEPC_EXTERN PetscErrorCode BVSetRandomSign(BV);
    189: SLEPC_EXTERN PetscErrorCode BVSetRandomColumn(BV,PetscInt);
    190: SLEPC_EXTERN PetscErrorCode BVSetRandomCond(BV,PetscReal);
    191: SLEPC_EXTERN PetscErrorCode BVSetRandomContext(BV,PetscRandom);
    192: SLEPC_EXTERN PetscErrorCode BVGetRandomContext(BV,PetscRandom*);

    194: SLEPC_EXTERN PetscErrorCode BVSetOrthogonalization(BV,BVOrthogType,BVOrthogRefineType,PetscReal,BVOrthogBlockType);
    195: SLEPC_EXTERN PetscErrorCode BVGetOrthogonalization(BV,BVOrthogType*,BVOrthogRefineType*,PetscReal*,BVOrthogBlockType*);
    196: SLEPC_EXTERN PetscErrorCode BVOrthogonalize(BV,Mat);
    197: SLEPC_EXTERN PetscErrorCode BVOrthogonalizeVec(BV,Vec,PetscScalar*,PetscReal*,PetscBool*);
    198: SLEPC_EXTERN PetscErrorCode BVOrthogonalizeColumn(BV,PetscInt,PetscScalar*,PetscReal*,PetscBool*);
    199: SLEPC_EXTERN PetscErrorCode BVOrthonormalizeColumn(BV,PetscInt,PetscBool,PetscReal*,PetscBool*);
    200: SLEPC_EXTERN PetscErrorCode BVOrthogonalizeSomeColumn(BV,PetscInt,PetscBool*,PetscScalar*,PetscReal*,PetscBool*);
    201: SLEPC_EXTERN PetscErrorCode BVBiorthogonalizeColumn(BV,BV,PetscInt);
    202: SLEPC_EXTERN PetscErrorCode BVBiorthonormalizeColumn(BV,BV,PetscInt,PetscReal*);
    203: SLEPC_EXTERN PetscErrorCode BVSetMatMultMethod(BV,BVMatMultType);
    204: SLEPC_EXTERN PetscErrorCode BVGetMatMultMethod(BV,BVMatMultType*);

    206: SLEPC_EXTERN PetscErrorCode BVCreateFromMat(Mat,BV*);
    207: SLEPC_EXTERN PetscErrorCode BVCreateMat(BV,Mat*);
    208: SLEPC_EXTERN PetscErrorCode BVGetMat(BV,Mat*);
    209: SLEPC_EXTERN PetscErrorCode BVRestoreMat(BV,Mat*);

    211: SLEPC_EXTERN PetscErrorCode BVScatter(BV,BV,VecScatter,Vec);
    212: SLEPC_EXTERN PetscErrorCode BVSumQuadrature(BV,BV,PetscInt,PetscInt,PetscInt,PetscScalar*,PetscScalar*,VecScatter,PetscSubcomm,PetscInt,PetscBool);
    213: SLEPC_EXTERN PetscErrorCode BVDotQuadrature(BV,BV,PetscScalar*,PetscInt,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscSubcomm,PetscInt,PetscBool);
    214: SLEPC_EXTERN PetscErrorCode BVTraceQuadrature(BV,BV,PetscInt,PetscInt,PetscScalar*,VecScatter,PetscSubcomm,PetscInt,PetscBool,PetscReal*);

    216: /*E
    217:    BVSVDMethod - Different methods for computing the SVD of a BV

    219:    Notes:
    220:    Allowed values are
    221: +  BV_SVD_METHOD_REFINE - based on the SVD of the cross product matrix S'*S, with refinement
    222: .  BV_SVD_METHOD_QR     - based on the SVD of the triangular factor of qr(S)
    223: -  BV_SVD_METHOD_QR_CAA - variant of QR intended for use in cammunication-avoiding Arnoldi

    225:    Level: developer

    227: .seealso: BVSVDAndRank()
    228: E*/
    229: typedef enum { BV_SVD_METHOD_REFINE,
    230:                BV_SVD_METHOD_QR,
    231:                BV_SVD_METHOD_QR_CAA } BVSVDMethod;
    232: SLEPC_EXTERN const char *BVSVDMethods[];

    234: SLEPC_EXTERN PetscErrorCode BVSVDAndRank(BV,PetscInt,PetscInt,PetscReal,BVSVDMethod,PetscScalar*,PetscReal*,PetscInt*);
    235: SLEPC_EXTERN PetscErrorCode BVCISSResizeBases(BV,BV,BV,PetscInt,PetscInt,PetscInt,PetscInt);

    237: SLEPC_EXTERN PetscErrorCode BVCreateTensor(BV,PetscInt,BV*);
    238: SLEPC_EXTERN PetscErrorCode BVTensorBuildFirstColumn(BV,PetscInt);
    239: SLEPC_EXTERN PetscErrorCode BVTensorCompress(BV,PetscInt);
    240: SLEPC_EXTERN PetscErrorCode BVTensorGetDegree(BV,PetscInt*);
    241: SLEPC_EXTERN PetscErrorCode BVTensorGetFactors(BV,BV*,Mat*);
    242: SLEPC_EXTERN PetscErrorCode BVTensorRestoreFactors(BV,BV*,Mat*);

    244: SLEPC_EXTERN PetscErrorCode BVSetOptionsPrefix(BV,const char*);
    245: SLEPC_EXTERN PetscErrorCode BVAppendOptionsPrefix(BV,const char*);
    246: SLEPC_EXTERN PetscErrorCode BVGetOptionsPrefix(BV,const char*[]);

    248: SLEPC_EXTERN PetscFunctionList BVList;
    249: SLEPC_EXTERN PetscErrorCode BVRegister(const char[],PetscErrorCode(*)(BV));

    251: #endif