Actual source code: slepcsvd.h

  1: /*
  2:    User interface for the SLEPC singular value solvers. 

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

  8:    This file is part of SLEPc.
  9:       
 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 slepcsys.h
 27:  #include slepceps.h


 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: /*E
 43:     SVDType - String with the name of a SLEPc singular value solver

 45:    Level: beginner

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

 56: /*E
 57:     SVDTransposeMode - determines how to handle the transpose of the matrix

 59:     Level: advanced

 61: .seealso: SVDSetTransposeMode(), SVDGetTransposeMode()
 62: E*/
 63: typedef enum { SVD_TRANSPOSE_EXPLICIT,
 64:                SVD_TRANSPOSE_IMPLICIT } SVDTransposeMode;

 66: /*E
 67:     SVDWhich - determines whether largest or smallest singular triplets
 68:     are to be computed

 70:     Level: intermediate

 72: .seealso: SVDSetWhichSingularTriplets(), SVDGetWhichSingularTriplets()
 73: E*/
 74: typedef enum { SVD_LARGEST,
 75:                SVD_SMALLEST } SVDWhich;

 77: /*E
 78:     SVDConvergedReason - reason a singular value solver was said to 
 79:          have converged or diverged

 81:    Level: beginner

 83: .seealso: SVDSolve(), SVDGetConvergedReason(), SVDSetTolerances()
 84: E*/
 85: typedef enum {/* converged */
 86:               SVD_CONVERGED_TOL                =  2,
 87:               /* diverged */
 88:               SVD_DIVERGED_ITS                 = -3,
 89:               SVD_DIVERGED_BREAKDOWN           = -4,
 90:               SVD_CONVERGED_ITERATING          =  0 } SVDConvergedReason;

 92: EXTERN PetscErrorCode SVDCreate(MPI_Comm,SVD*);
 93: EXTERN PetscErrorCode SVDSetIP(SVD,IP);
 94: EXTERN PetscErrorCode SVDGetIP(SVD,IP*);
 95: EXTERN PetscErrorCode SVDSetType(SVD,const SVDType);
 96: EXTERN PetscErrorCode SVDGetType(SVD,const SVDType*);
 97: EXTERN PetscErrorCode SVDSetOperator(SVD,Mat);
 98: EXTERN PetscErrorCode SVDGetOperator(SVD,Mat*);
 99: EXTERN PetscErrorCode SVDSetInitialSpace(SVD,PetscInt,Vec*);
100: EXTERN PetscErrorCode SVDSetTransposeMode(SVD,SVDTransposeMode);
101: EXTERN PetscErrorCode SVDGetTransposeMode(SVD,SVDTransposeMode*);
102: EXTERN PetscErrorCode SVDSetDimensions(SVD,PetscInt,PetscInt,PetscInt);
103: EXTERN PetscErrorCode SVDGetDimensions(SVD,PetscInt*,PetscInt*,PetscInt*);
104: EXTERN PetscErrorCode SVDSetTolerances(SVD,PetscReal,PetscInt);
105: EXTERN PetscErrorCode SVDGetTolerances(SVD,PetscReal*,PetscInt*);
106: EXTERN PetscErrorCode SVDSetWhichSingularTriplets(SVD,SVDWhich);
107: EXTERN PetscErrorCode SVDGetWhichSingularTriplets(SVD,SVDWhich*);
108: EXTERN PetscErrorCode SVDSetFromOptions(SVD);
109: EXTERN PetscErrorCode SVDSetOptionsPrefix(SVD,const char*);
110: EXTERN PetscErrorCode SVDAppendOptionsPrefix(SVD,const char*);
111: EXTERN PetscErrorCode SVDGetOptionsPrefix(SVD,const char*[]);
112: EXTERN PetscErrorCode SVDSetUp(SVD);
113: EXTERN PetscErrorCode SVDSolve(SVD);
114: EXTERN PetscErrorCode SVDGetIterationNumber(SVD,PetscInt*);
115: EXTERN PetscErrorCode SVDGetConvergedReason(SVD,SVDConvergedReason*);
116: EXTERN PetscErrorCode SVDGetConverged(SVD,PetscInt*);
117: EXTERN PetscErrorCode SVDGetSingularTriplet(SVD,PetscInt,PetscReal*,Vec,Vec);
118: EXTERN PetscErrorCode SVDComputeResidualNorms(SVD,PetscInt,PetscReal*,PetscReal*);
119: EXTERN PetscErrorCode SVDComputeRelativeError(SVD,PetscInt,PetscReal*);
120: EXTERN PetscErrorCode SVDGetOperationCounters(SVD,PetscInt*,PetscInt*);
121: EXTERN PetscErrorCode SVDView(SVD,PetscViewer);
122: EXTERN PetscErrorCode SVDDestroy(SVD);

124: EXTERN PetscErrorCode SVDMonitorSet(SVD,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),
125:                                     void*,PetscErrorCode (*monitordestroy)(void*));
126: EXTERN PetscErrorCode SVDMonitorCancel(SVD);
127: EXTERN PetscErrorCode SVDGetMonitorContext(SVD,void **);
128: EXTERN PetscErrorCode SVDMonitorAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
129: EXTERN PetscErrorCode SVDMonitorFirst(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
130: EXTERN PetscErrorCode SVDMonitorConverged(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
131: EXTERN PetscErrorCode SVDMonitorLG(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
132: EXTERN PetscErrorCode SVDMonitorLGAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);

134: EXTERN PetscErrorCode SVDSetTrackAll(SVD,PetscTruth);
135: EXTERN PetscErrorCode SVDGetTrackAll(SVD,PetscTruth*);

137: EXTERN PetscErrorCode SVDDense(PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscScalar*,PetscScalar*);

139: EXTERN PetscErrorCode SVDCrossSetEPS(SVD,EPS);
140: EXTERN PetscErrorCode SVDCrossGetEPS(SVD,EPS*);

142: EXTERN PetscErrorCode SVDCyclicSetExplicitMatrix(SVD,PetscTruth);
143: EXTERN PetscErrorCode SVDCyclicGetExplicitMatrix(SVD,PetscTruth*);
144: EXTERN PetscErrorCode SVDCyclicSetEPS(SVD,EPS);
145: EXTERN PetscErrorCode SVDCyclicGetEPS(SVD,EPS*);

147: EXTERN PetscErrorCode SVDLanczosSetOneSide(SVD,PetscTruth);
148: EXTERN PetscErrorCode SVDLanczosGetOneSide(SVD,PetscTruth*);

150: EXTERN PetscErrorCode SVDTRLanczosSetOneSide(SVD,PetscTruth);
151: EXTERN PetscErrorCode SVDTRLanczosGetOneSide(SVD,PetscTruth*);

153: EXTERN PetscErrorCode SVDRegister(const char*,const char*,const char*,PetscErrorCode(*)(SVD));
154: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
155: #define SVDRegisterDynamic(a,b,c,d) SVDRegister(a,b,c,0)
156: #else
157: #define SVDRegisterDynamic(a,b,c,d) SVDRegister(a,b,c,d)
158: #endif
159: EXTERN PetscErrorCode SVDRegisterDestroy(void);

162: #endif