Date: 2021-02-01T14:42:23+00:00

Actual source code: slepcsvd.h
slepc-3.14.2 2021-02-01
Report Typos and Errors

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-2020, 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 SLEPc's singular value solvers
     12: */

     14: #if !defined(SLEPCSVD_H)
     15: #define SLEPCSVD_H
     16: #include <slepceps.h>
     17: #include <slepcbv.h>
     18: #include <slepcds.h>

     20: SLEPC_EXTERN PetscErrorCode SVDInitializePackage(void);

     22: /*S
     23:      SVD - Abstract SLEPc object that manages all the singular value
     24:      problem solvers.

     26:    Level: beginner

     28: .seealso:  SVDCreate()
     29: S*/
     30: typedef struct _p_SVD* SVD;

     32: /*J
     33:     SVDType - String with the name of a SLEPc singular value solver

     35:    Level: beginner

     37: .seealso: SVDSetType(), SVD
     38: J*/
     39: typedef const char* SVDType;
     40: #define SVDCROSS       "cross"
     41: #define SVDCYCLIC      "cyclic"
     42: #define SVDLAPACK      "lapack"
     43: #define SVDLANCZOS     "lanczos"
     44: #define SVDTRLANCZOS   "trlanczos"
     45: #define SVDSCALAPACK   "scalapack"
     46: #define SVDELEMENTAL   "elemental"
     47: #define SVDPRIMME      "primme"

     49: /* Logging support */
     50: SLEPC_EXTERN PetscClassId SVD_CLASSID;

     52: /*E
     53:     SVDWhich - Determines whether largest or smallest singular triplets
     54:     are to be computed

     56:     Level: intermediate

     58: .seealso: SVDSetWhichSingularTriplets(), SVDGetWhichSingularTriplets()
     59: E*/
     60: typedef enum { SVD_LARGEST,
     61:                SVD_SMALLEST } SVDWhich;

     63: /*E
     64:     SVDErrorType - The error type used to assess accuracy of computed solutions

     66:     Level: intermediate

     68: .seealso: SVDComputeError()
     69: E*/
     70: typedef enum { SVD_ERROR_ABSOLUTE,
     71:                SVD_ERROR_RELATIVE } SVDErrorType;
     72: SLEPC_EXTERN const char *SVDErrorTypes[];

     74: /*E
     75:     SVDConv - Determines the convergence test

     77:     Level: intermediate

     79: .seealso: SVDSetConvergenceTest(), SVDSetConvergenceTestFunction()
     80: E*/
     81: typedef enum { SVD_CONV_ABS,
     82:                SVD_CONV_REL,
     83:                SVD_CONV_USER } SVDConv;

     85: /*E
     86:     SVDStop - Determines the stopping test

     88:     Level: advanced

     90: .seealso: SVDSetStoppingTest(), SVDSetStoppingTestFunction()
     91: E*/
     92: typedef enum { SVD_STOP_BASIC,
     93:                SVD_STOP_USER } SVDStop;

     95: /*E
     96:     SVDConvergedReason - Reason a singular value solver was said to
     97:          have converged or diverged

     99:    Level: intermediate

    101: .seealso: SVDSolve(), SVDGetConvergedReason(), SVDSetTolerances()
    102: E*/
    103: typedef enum {/* converged */
    104:               SVD_CONVERGED_TOL                =  1,
    105:               SVD_CONVERGED_USER               =  2,
    106:               /* diverged */
    107:               SVD_DIVERGED_ITS                 = -1,
    108:               SVD_DIVERGED_BREAKDOWN           = -2,
    109:               SVD_CONVERGED_ITERATING          =  0 } SVDConvergedReason;
    110: SLEPC_EXTERN const char *const*SVDConvergedReasons;

    112: SLEPC_EXTERN PetscErrorCode SVDCreate(MPI_Comm,SVD*);
    113: SLEPC_EXTERN PetscErrorCode SVDSetBV(SVD,BV,BV);
    114: SLEPC_EXTERN PetscErrorCode SVDGetBV(SVD,BV*,BV*);
    115: SLEPC_EXTERN PetscErrorCode SVDSetDS(SVD,DS);
    116: SLEPC_EXTERN PetscErrorCode SVDGetDS(SVD,DS*);
    117: SLEPC_EXTERN PetscErrorCode SVDSetType(SVD,SVDType);
    118: SLEPC_EXTERN PetscErrorCode SVDGetType(SVD,SVDType*);
    119: SLEPC_EXTERN PetscErrorCode SVDSetOperator(SVD,Mat);
    120: SLEPC_EXTERN PetscErrorCode SVDGetOperator(SVD,Mat*);
    121: SLEPC_EXTERN PetscErrorCode SVDSetInitialSpaces(SVD,PetscInt,Vec[],PetscInt,Vec[]);
    122: PETSC_DEPRECATED_FUNCTION("Use SVDSetInitialSpaces()") PETSC_STATIC_INLINE PetscErrorCode SVDSetInitialSpace(SVD svd,PetscInt nr,Vec *isr) {return SVDSetInitialSpaces(svd,nr,isr,0,NULL);}
    123: PETSC_DEPRECATED_FUNCTION("Use SVDSetInitialSpaces()") PETSC_STATIC_INLINE PetscErrorCode SVDSetInitialSpaceLeft(SVD svd,PetscInt nl,Vec *isl) {return SVDSetInitialSpaces(svd,0,NULL,nl,isl);}
    124: SLEPC_EXTERN PetscErrorCode SVDSetImplicitTranspose(SVD,PetscBool);
    125: SLEPC_EXTERN PetscErrorCode SVDGetImplicitTranspose(SVD,PetscBool*);
    126: SLEPC_EXTERN PetscErrorCode SVDSetDimensions(SVD,PetscInt,PetscInt,PetscInt);
    127: SLEPC_EXTERN PetscErrorCode SVDGetDimensions(SVD,PetscInt*,PetscInt*,PetscInt*);
    128: SLEPC_EXTERN PetscErrorCode SVDSetTolerances(SVD,PetscReal,PetscInt);
    129: SLEPC_EXTERN PetscErrorCode SVDGetTolerances(SVD,PetscReal*,PetscInt*);
    130: SLEPC_EXTERN PetscErrorCode SVDSetWhichSingularTriplets(SVD,SVDWhich);
    131: SLEPC_EXTERN PetscErrorCode SVDGetWhichSingularTriplets(SVD,SVDWhich*);
    132: SLEPC_EXTERN PetscErrorCode SVDSetFromOptions(SVD);
    133: SLEPC_EXTERN PetscErrorCode SVDSetOptionsPrefix(SVD,const char*);
    134: SLEPC_EXTERN PetscErrorCode SVDAppendOptionsPrefix(SVD,const char*);
    135: SLEPC_EXTERN PetscErrorCode SVDGetOptionsPrefix(SVD,const char*[]);
    136: SLEPC_EXTERN PetscErrorCode SVDSetUp(SVD);
    137: SLEPC_EXTERN PetscErrorCode SVDSolve(SVD);
    138: SLEPC_EXTERN PetscErrorCode SVDGetIterationNumber(SVD,PetscInt*);
    139: SLEPC_EXTERN PetscErrorCode SVDSetConvergenceTestFunction(SVD,PetscErrorCode (*)(SVD,PetscReal,PetscReal,PetscReal*,void*),void*,PetscErrorCode (*)(void*));
    140: SLEPC_EXTERN PetscErrorCode SVDSetConvergenceTest(SVD,SVDConv);
    141: SLEPC_EXTERN PetscErrorCode SVDGetConvergenceTest(SVD,SVDConv*);
    142: SLEPC_EXTERN PetscErrorCode SVDConvergedAbsolute(SVD,PetscReal,PetscReal,PetscReal*,void*);
    143: SLEPC_EXTERN PetscErrorCode SVDConvergedRelative(SVD,PetscReal,PetscReal,PetscReal*,void*);
    144: SLEPC_EXTERN PetscErrorCode SVDSetStoppingTestFunction(SVD,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscInt,PetscInt,SVDConvergedReason*,void*),void*,PetscErrorCode (*)(void*));
    145: SLEPC_EXTERN PetscErrorCode SVDSetStoppingTest(SVD,SVDStop);
    146: SLEPC_EXTERN PetscErrorCode SVDGetStoppingTest(SVD,SVDStop*);
    147: SLEPC_EXTERN PetscErrorCode SVDStoppingBasic(SVD,PetscInt,PetscInt,PetscInt,PetscInt,SVDConvergedReason*,void*);
    148: SLEPC_EXTERN PetscErrorCode SVDGetConvergedReason(SVD,SVDConvergedReason*);
    149: SLEPC_EXTERN PetscErrorCode SVDGetConverged(SVD,PetscInt*);
    150: SLEPC_EXTERN PetscErrorCode SVDGetSingularTriplet(SVD,PetscInt,PetscReal*,Vec,Vec);
    151: SLEPC_EXTERN PetscErrorCode SVDComputeError(SVD,PetscInt,SVDErrorType,PetscReal*);
    152: PETSC_DEPRECATED_FUNCTION("Use SVDComputeError()") PETSC_STATIC_INLINE PetscErrorCode SVDComputeRelativeError(SVD svd,PetscInt i,PetscReal *r) {return SVDComputeError(svd,i,SVD_ERROR_RELATIVE,r);}
    153: PETSC_DEPRECATED_FUNCTION("Use SVDComputeError() with SVD_ERROR_ABSOLUTE") PETSC_STATIC_INLINE PetscErrorCode SVDComputeResidualNorms(SVD svd,PetscInt i,PetscReal *r1,PETSC_UNUSED PetscReal *r2) {return SVDComputeError(svd,i,SVD_ERROR_ABSOLUTE,r1);}
    154: SLEPC_EXTERN PetscErrorCode SVDView(SVD,PetscViewer);
    155: SLEPC_EXTERN PetscErrorCode SVDViewFromOptions(SVD,PetscObject,const char[]);
    156: SLEPC_EXTERN PetscErrorCode SVDErrorView(SVD,SVDErrorType,PetscViewer);
    157: PETSC_DEPRECATED_FUNCTION("Use SVDErrorView()") PETSC_STATIC_INLINE PetscErrorCode SVDPrintSolution(SVD svd,PetscViewer v) {return SVDErrorView(svd,SVD_ERROR_RELATIVE,v);}
    158: SLEPC_EXTERN PetscErrorCode SVDErrorViewFromOptions(SVD);
    159: SLEPC_EXTERN PetscErrorCode SVDConvergedReasonView(SVD,PetscViewer);
    160: SLEPC_EXTERN PetscErrorCode SVDConvergedReasonViewFromOptions(SVD);
    161: PETSC_DEPRECATED_FUNCTION("Use SVDConvergedReasonView() (since version 3.14)") PETSC_STATIC_INLINE PetscErrorCode SVDReasonView(SVD svd,PetscViewer v) {return SVDConvergedReasonView(svd,v);}
    162: PETSC_DEPRECATED_FUNCTION("Use SVDConvergedReasonViewFromOptions() (since version 3.14)") PETSC_STATIC_INLINE PetscErrorCode SVDReasonViewFromOptions(SVD svd) {return SVDConvergedReasonViewFromOptions(svd);}
    163: SLEPC_EXTERN PetscErrorCode SVDValuesView(SVD,PetscViewer);
    164: SLEPC_EXTERN PetscErrorCode SVDValuesViewFromOptions(SVD);
    165: SLEPC_EXTERN PetscErrorCode SVDVectorsView(SVD,PetscViewer);
    166: SLEPC_EXTERN PetscErrorCode SVDVectorsViewFromOptions(SVD);
    167: SLEPC_EXTERN PetscErrorCode SVDDestroy(SVD*);
    168: SLEPC_EXTERN PetscErrorCode SVDReset(SVD);

    170: SLEPC_EXTERN PetscErrorCode SVDMonitor(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt);
    171: SLEPC_EXTERN PetscErrorCode SVDMonitorSet(SVD,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
    172: SLEPC_EXTERN PetscErrorCode SVDMonitorSetFromOptions(SVD,const char*,const char*,const char*,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,PetscViewerAndFormat*),PetscBool);
    173: SLEPC_EXTERN PetscErrorCode SVDConvMonitorSetFromOptions(SVD,const char*,const char*,const char*,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,SlepcConvMonitor));
    174: SLEPC_EXTERN PetscErrorCode SVDMonitorCancel(SVD);
    175: SLEPC_EXTERN PetscErrorCode SVDGetMonitorContext(SVD,void **);
    176: SLEPC_EXTERN PetscErrorCode SVDMonitorAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,PetscViewerAndFormat*);
    177: SLEPC_EXTERN PetscErrorCode SVDMonitorFirst(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,PetscViewerAndFormat*);
    178: SLEPC_EXTERN PetscErrorCode SVDMonitorConverged(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,SlepcConvMonitor);
    179: SLEPC_EXTERN PetscErrorCode SVDMonitorLGCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscDrawLG*);
    180: SLEPC_EXTERN PetscErrorCode SVDMonitorLG(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
    181: SLEPC_EXTERN PetscErrorCode SVDMonitorLGAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);

    183: SLEPC_EXTERN PetscErrorCode SVDSetTrackAll(SVD,PetscBool);
    184: SLEPC_EXTERN PetscErrorCode SVDGetTrackAll(SVD,PetscBool*);

    186: SLEPC_EXTERN PetscFunctionList SVDList;
    187: SLEPC_EXTERN PetscErrorCode SVDRegister(const char[],PetscErrorCode(*)(SVD));

    189: SLEPC_EXTERN PetscErrorCode SVDAllocateSolution(SVD,PetscInt);

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

    193: SLEPC_EXTERN PetscErrorCode SVDCrossSetExplicitMatrix(SVD,PetscBool);
    194: SLEPC_EXTERN PetscErrorCode SVDCrossGetExplicitMatrix(SVD,PetscBool*);
    195: SLEPC_EXTERN PetscErrorCode SVDCrossSetEPS(SVD,EPS);
    196: SLEPC_EXTERN PetscErrorCode SVDCrossGetEPS(SVD,EPS*);

    198: SLEPC_EXTERN PetscErrorCode SVDCyclicSetExplicitMatrix(SVD,PetscBool);
    199: SLEPC_EXTERN PetscErrorCode SVDCyclicGetExplicitMatrix(SVD,PetscBool*);
    200: SLEPC_EXTERN PetscErrorCode SVDCyclicSetEPS(SVD,EPS);
    201: SLEPC_EXTERN PetscErrorCode SVDCyclicGetEPS(SVD,EPS*);

    203: SLEPC_EXTERN PetscErrorCode SVDLanczosSetOneSide(SVD,PetscBool);
    204: SLEPC_EXTERN PetscErrorCode SVDLanczosGetOneSide(SVD,PetscBool*);

    206: SLEPC_EXTERN PetscErrorCode SVDTRLanczosSetOneSide(SVD,PetscBool);
    207: SLEPC_EXTERN PetscErrorCode SVDTRLanczosGetOneSide(SVD,PetscBool*);

    209: /*E
    210:     SVDPRIMMEMethod - determines the SVD method selected in the PRIMME library

    212:     Level: advanced

    214: .seealso: SVDPRIMMESetMethod(), SVDPRIMMEGetMethod()
    215: E*/
    216: typedef enum { SVD_PRIMME_HYBRID=1,
    217:                SVD_PRIMME_NORMALEQUATIONS,
    218:                SVD_PRIMME_AUGMENTED } SVDPRIMMEMethod;
    219: SLEPC_EXTERN const char *SVDPRIMMEMethods[];

    221: SLEPC_EXTERN PetscErrorCode SVDPRIMMESetBlockSize(SVD,PetscInt);
    222: SLEPC_EXTERN PetscErrorCode SVDPRIMMEGetBlockSize(SVD,PetscInt*);
    223: SLEPC_EXTERN PetscErrorCode SVDPRIMMESetMethod(SVD,SVDPRIMMEMethod);
    224: SLEPC_EXTERN PetscErrorCode SVDPRIMMEGetMethod(SVD,SVDPRIMMEMethod*);

    226: #endif