Date: 2016-03-29T14:59:35+00:00

Actual source code: slepcsvd.h
slepc-3.6.3 2016-03-29
Report Typos and Errors

      1: /*
      2:    User interface for SLEPc's singular value solvers.

      4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      6:    Copyright (c) 2002-2015, Universitat Politecnica de Valencia, Spain

      8:    This file is part of SLEPc.

     10:    SLEPc is free software: you can redistribute it and/or modify it under  the
     11:    terms of version 3 of the GNU Lesser General Public License as published by
     12:    the Free Software Foundation.

     14:    SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
     15:    WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
     16:    FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
     17:    more details.

     19:    You  should have received a copy of the GNU Lesser General  Public  License
     20:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
     21:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     22: */

     26: #include <slepceps.h>
     27: #include <slepcbv.h>
     28: #include <slepcds.h>

     30: PETSC_EXTERN PetscErrorCode SVDInitializePackage(void);

     32: /*S
     33:      SVD - Abstract SLEPc object that manages all the singular value
     34:      problem solvers.

     36:    Level: beginner

     38: .seealso:  SVDCreate()
     39: S*/
     40: typedef struct _p_SVD* SVD;

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

     45:    Level: beginner

     47: .seealso: SVDSetType(), SVD
     48: J*/
     49: typedef const char* SVDType;
     50: #define SVDCROSS       "cross"
     51: #define SVDCYCLIC      "cyclic"
     52: #define SVDLAPACK      "lapack"
     53: #define SVDLANCZOS     "lanczos"
     54: #define SVDTRLANCZOS   "trlanczos"

     56: /* Logging support */
     57: PETSC_EXTERN PetscClassId SVD_CLASSID;

     59: /*E
     60:     SVDWhich - Determines whether largest or smallest singular triplets
     61:     are to be computed

     63:     Level: intermediate

     65: .seealso: SVDSetWhichSingularTriplets(), SVDGetWhichSingularTriplets()
     66: E*/
     67: typedef enum { SVD_LARGEST,
     68:                SVD_SMALLEST } SVDWhich;

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

     73:     Level: intermediate

     75: .seealso: SVDComputeError()
     76: E*/
     77: typedef enum { SVD_ERROR_ABSOLUTE,
     78:                SVD_ERROR_RELATIVE } SVDErrorType;
     79: PETSC_EXTERN const char *SVDErrorTypes[];

     81: /*E
     82:     SVDConvergedReason - Reason a singular value solver was said to
     83:          have converged or diverged

     85:    Level: intermediate

     87: .seealso: SVDSolve(), SVDGetConvergedReason(), SVDSetTolerances()
     88: E*/
     89: typedef enum {/* converged */
     90:               SVD_CONVERGED_TOL                =  2,
     91:               /* diverged */
     92:               SVD_DIVERGED_ITS                 = -3,
     93:               SVD_DIVERGED_BREAKDOWN           = -4,
     94:               SVD_CONVERGED_ITERATING          =  0 } SVDConvergedReason;
     95: PETSC_EXTERN const char *const*SVDConvergedReasons;

     97: PETSC_EXTERN PetscErrorCode SVDCreate(MPI_Comm,SVD*);
     98: PETSC_EXTERN PetscErrorCode SVDSetBV(SVD,BV,BV);
     99: PETSC_EXTERN PetscErrorCode SVDGetBV(SVD,BV*,BV*);
    100: PETSC_EXTERN PetscErrorCode SVDSetDS(SVD,DS);
    101: PETSC_EXTERN PetscErrorCode SVDGetDS(SVD,DS*);
    102: PETSC_EXTERN PetscErrorCode SVDSetType(SVD,SVDType);
    103: PETSC_EXTERN PetscErrorCode SVDGetType(SVD,SVDType*);
    104: PETSC_EXTERN PetscErrorCode SVDSetOperator(SVD,Mat);
    105: PETSC_EXTERN PetscErrorCode SVDGetOperator(SVD,Mat*);
    106: PETSC_EXTERN PetscErrorCode SVDSetInitialSpace(SVD,PetscInt,Vec*);
    107: PETSC_EXTERN PetscErrorCode SVDSetInitialSpaceLeft(SVD,PetscInt,Vec*);
    108: PETSC_EXTERN PetscErrorCode SVDSetImplicitTranspose(SVD,PetscBool);
    109: PETSC_EXTERN PetscErrorCode SVDGetImplicitTranspose(SVD,PetscBool*);
    110: PETSC_EXTERN PetscErrorCode SVDSetDimensions(SVD,PetscInt,PetscInt,PetscInt);
    111: PETSC_EXTERN PetscErrorCode SVDGetDimensions(SVD,PetscInt*,PetscInt*,PetscInt*);
    112: PETSC_EXTERN PetscErrorCode SVDSetTolerances(SVD,PetscReal,PetscInt);
    113: PETSC_EXTERN PetscErrorCode SVDGetTolerances(SVD,PetscReal*,PetscInt*);
    114: PETSC_EXTERN PetscErrorCode SVDSetWhichSingularTriplets(SVD,SVDWhich);
    115: PETSC_EXTERN PetscErrorCode SVDGetWhichSingularTriplets(SVD,SVDWhich*);
    116: PETSC_EXTERN PetscErrorCode SVDSetFromOptions(SVD);
    117: PETSC_EXTERN PetscErrorCode SVDSetOptionsPrefix(SVD,const char*);
    118: PETSC_EXTERN PetscErrorCode SVDAppendOptionsPrefix(SVD,const char*);
    119: PETSC_EXTERN PetscErrorCode SVDGetOptionsPrefix(SVD,const char*[]);
    120: PETSC_EXTERN PetscErrorCode SVDSetUp(SVD);
    121: PETSC_EXTERN PetscErrorCode SVDSolve(SVD);
    122: PETSC_EXTERN PetscErrorCode SVDGetIterationNumber(SVD,PetscInt*);
    123: PETSC_EXTERN PetscErrorCode SVDGetConvergedReason(SVD,SVDConvergedReason*);
    124: PETSC_EXTERN PetscErrorCode SVDGetConverged(SVD,PetscInt*);
    125: PETSC_EXTERN PetscErrorCode SVDGetSingularTriplet(SVD,PetscInt,PetscReal*,Vec,Vec);
    126: PETSC_EXTERN PetscErrorCode SVDComputeError(SVD,PetscInt,SVDErrorType,PetscReal*);
    127: PETSC_DEPRECATED("Use SVDComputeError()") PETSC_STATIC_INLINE PetscErrorCode SVDComputeRelativeError(SVD svd,PetscInt i,PetscReal *r) {return SVDComputeError(svd,i,SVD_ERROR_RELATIVE,r);}
    128: PETSC_DEPRECATED("Use SVDComputeError() with SVD_ERROR_ABSOLUTE") PETSC_STATIC_INLINE PetscErrorCode SVDComputeResidualNorms(SVD svd,PetscInt i,PetscReal *r1,PetscReal *r2) {return SVDComputeError(svd,i,SVD_ERROR_ABSOLUTE,r1);}
    129: PETSC_EXTERN PetscErrorCode SVDView(SVD,PetscViewer);
    130: PETSC_STATIC_INLINE PetscErrorCode SVDViewFromOptions(SVD svd,PetscObject obj,const char name[]) {return PetscObjectViewFromOptions((PetscObject)svd,obj,name);}
    131: PETSC_EXTERN PetscErrorCode SVDErrorView(SVD,SVDErrorType,PetscViewer);
    132: PETSC_DEPRECATED("Use SVDErrorView()") PETSC_STATIC_INLINE PetscErrorCode SVDPrintSolution(SVD svd,PetscViewer v) {return SVDErrorView(svd,SVD_ERROR_RELATIVE,v);}
    133: PETSC_EXTERN PetscErrorCode SVDErrorViewFromOptions(SVD);
    134: PETSC_EXTERN PetscErrorCode SVDReasonView(SVD,PetscViewer);
    135: PETSC_EXTERN PetscErrorCode SVDReasonViewFromOptions(SVD);
    136: PETSC_EXTERN PetscErrorCode SVDValuesView(SVD,PetscViewer);
    137: PETSC_EXTERN PetscErrorCode SVDValuesViewFromOptions(SVD);
    138: PETSC_EXTERN PetscErrorCode SVDVectorsView(SVD,PetscViewer);
    139: PETSC_EXTERN PetscErrorCode SVDVectorsViewFromOptions(SVD);
    140: PETSC_EXTERN PetscErrorCode SVDDestroy(SVD*);
    141: PETSC_EXTERN PetscErrorCode SVDReset(SVD);

    143: PETSC_EXTERN PetscErrorCode SVDMonitor(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt);
    144: PETSC_EXTERN PetscErrorCode SVDMonitorSet(SVD,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
    145: PETSC_EXTERN PetscErrorCode SVDMonitorCancel(SVD);
    146: PETSC_EXTERN PetscErrorCode SVDGetMonitorContext(SVD,void **);
    147: PETSC_EXTERN PetscErrorCode SVDMonitorAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
    148: PETSC_EXTERN PetscErrorCode SVDMonitorFirst(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
    149: PETSC_EXTERN PetscErrorCode SVDMonitorConverged(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
    150: PETSC_EXTERN PetscErrorCode SVDMonitorLG(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
    151: PETSC_EXTERN PetscErrorCode SVDMonitorLGAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);

    153: PETSC_EXTERN PetscErrorCode SVDSetTrackAll(SVD,PetscBool);
    154: PETSC_EXTERN PetscErrorCode SVDGetTrackAll(SVD,PetscBool*);

    156: PETSC_EXTERN PetscErrorCode SVDCrossSetEPS(SVD,EPS);
    157: PETSC_EXTERN PetscErrorCode SVDCrossGetEPS(SVD,EPS*);

    159: PETSC_EXTERN PetscErrorCode SVDCyclicSetExplicitMatrix(SVD,PetscBool);
    160: PETSC_EXTERN PetscErrorCode SVDCyclicGetExplicitMatrix(SVD,PetscBool*);
    161: PETSC_EXTERN PetscErrorCode SVDCyclicSetEPS(SVD,EPS);
    162: PETSC_EXTERN PetscErrorCode SVDCyclicGetEPS(SVD,EPS*);

    164: PETSC_EXTERN PetscErrorCode SVDLanczosSetOneSide(SVD,PetscBool);
    165: PETSC_EXTERN PetscErrorCode SVDLanczosGetOneSide(SVD,PetscBool*);

    167: PETSC_EXTERN PetscErrorCode SVDTRLanczosSetOneSide(SVD,PetscBool);
    168: PETSC_EXTERN PetscErrorCode SVDTRLanczosGetOneSide(SVD,PetscBool*);

    170: PETSC_EXTERN PetscFunctionList SVDList;
    171: PETSC_EXTERN PetscErrorCode SVDRegister(const char[],PetscErrorCode(*)(SVD));

    173: PETSC_EXTERN PetscErrorCode SVDAllocateSolution(SVD,PetscInt);

    175: #endif