Actual source code: slepcds.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2012, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.
  7:       
  8:    SLEPc is free software: you can redistribute it and/or modify it under  the
  9:    terms of version 3 of the GNU Lesser General Public License as published by
 10:    the Free Software Foundation.

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

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

 24:  #include slepcsys.h

 26: #define DS_MAX_SOLVE 6

 28: PETSC_EXTERN PetscErrorCode DSInitializePackage(const char[]);
 29: /*S
 30:     DS - Direct solver (or dense system), to represent low-dimensional
 31:     eigenproblems that must be solved within iterative solvers. This is an
 32:     auxiliary object and is not normally needed by application programmers.

 34:     Level: advanced

 36: .seealso:  DSCreate()
 37: S*/
 38: typedef struct _p_DS* DS;

 40: /*E
 41:     DSType - String with the name of the type of direct solver. Roughly,
 42:     there are as many types as problem types are available within SLEPc.

 44:     Level: advanced

 46: .seealso: DSSetType(), DS
 47: E*/
 48: #define DSType            char*
 49: #define DSHEP             "hep"
 50: #define DSNHEP            "nhep"
 51: #define DSGHEP            "ghep"
 52: #define DSGHIEP           "ghiep"
 53: #define DSGNHEP           "gnhep"
 54: #define DSSVD             "svd"
 55: #define DSQEP             "qep"

 57: /* Logging support */
 58: PETSC_EXTERN PetscClassId DS_CLASSID;

 60: /*E
 61:     DSStateType - to indicate in which state the direct solver is

 63:     Level: advanced

 65: .seealso: DSSetState()
 66: E*/
 67: typedef enum { DS_STATE_RAW,
 68:                DS_STATE_INTERMEDIATE,
 69:                DS_STATE_CONDENSED,
 70:                DS_STATE_TRUNCATED } DSStateType;

 72: /*E
 73:     DSMatType - to refer to one of the matrices stored internally in DS

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

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

 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_NUM_MAT } DSMatType;

112: PETSC_EXTERN PetscErrorCode DSCreate(MPI_Comm,DS*);
113: PETSC_EXTERN PetscErrorCode DSSetType(DS,const DSType);
114: PETSC_EXTERN PetscErrorCode DSGetType(DS,const DSType*);
115: PETSC_EXTERN PetscErrorCode DSSetOptionsPrefix(DS,const char *);
116: PETSC_EXTERN PetscErrorCode DSAppendOptionsPrefix(DS,const char *);
117: PETSC_EXTERN PetscErrorCode DSGetOptionsPrefix(DS,const char *[]);
118: PETSC_EXTERN PetscErrorCode DSSetFromOptions(DS);
119: PETSC_EXTERN PetscErrorCode DSView(DS,PetscViewer);
120: PETSC_EXTERN PetscErrorCode DSDestroy(DS*);
121: PETSC_EXTERN PetscErrorCode DSReset(DS);

123: PETSC_EXTERN PetscErrorCode DSAllocate(DS,PetscInt);
124: PETSC_EXTERN PetscErrorCode DSGetLeadingDimension(DS,PetscInt*);
125: PETSC_EXTERN PetscErrorCode DSSetState(DS,DSStateType);
126: PETSC_EXTERN PetscErrorCode DSGetState(DS,DSStateType*);
127: PETSC_EXTERN PetscErrorCode DSSetDimensions(DS,PetscInt,PetscInt,PetscInt,PetscInt);
128: PETSC_EXTERN PetscErrorCode DSGetDimensions(DS,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
129: PETSC_EXTERN PetscErrorCode DSTruncate(DS,PetscInt);
130: PETSC_EXTERN PetscErrorCode DSSetMethod(DS,PetscInt);
131: PETSC_EXTERN PetscErrorCode DSGetMethod(DS,PetscInt*);
132: PETSC_EXTERN PetscErrorCode DSSetCompact(DS,PetscBool);
133: PETSC_EXTERN PetscErrorCode DSGetCompact(DS,PetscBool*);
134: PETSC_EXTERN PetscErrorCode DSSetExtraRow(DS,PetscBool);
135: PETSC_EXTERN PetscErrorCode DSGetExtraRow(DS,PetscBool*);
136: PETSC_EXTERN PetscErrorCode DSSetRefined(DS,PetscBool);
137: PETSC_EXTERN PetscErrorCode DSGetRefined(DS,PetscBool*);
138: PETSC_EXTERN PetscErrorCode DSGetArray(DS,DSMatType,PetscScalar *a[]);
139: PETSC_EXTERN PetscErrorCode DSRestoreArray(DS,DSMatType,PetscScalar *a[]);
140: PETSC_EXTERN PetscErrorCode DSGetArrayReal(DS,DSMatType,PetscReal *a[]);
141: PETSC_EXTERN PetscErrorCode DSRestoreArrayReal(DS,DSMatType,PetscReal *a[]);
142: PETSC_EXTERN PetscErrorCode DSVectors(DS,DSMatType,PetscInt*,PetscReal*);
143: PETSC_EXTERN PetscErrorCode DSSolve(DS,PetscScalar*,PetscScalar*);
144: PETSC_EXTERN PetscErrorCode DSSort(DS,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*);
145: PETSC_EXTERN PetscErrorCode DSSetEigenvalueComparison(DS,PetscErrorCode (*)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*);
146: PETSC_EXTERN PetscErrorCode DSGetEigenvalueComparison(DS,PetscErrorCode (**)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void**);
147: PETSC_EXTERN PetscErrorCode DSUpdateExtraRow(DS);
148: PETSC_EXTERN PetscErrorCode DSCond(DS,PetscReal*);
149: PETSC_EXTERN PetscErrorCode DSTranslateHarmonic(DS,PetscScalar,PetscReal,PetscBool,PetscScalar*,PetscReal*);
150: PETSC_EXTERN PetscErrorCode DSTranslateRKS(DS,PetscScalar);
151: PETSC_EXTERN PetscErrorCode DSNormalize(DS,DSMatType,PetscInt);

153: PETSC_EXTERN PetscFList DSList;
154: PETSC_EXTERN PetscBool  DSRegisterAllCalled;
155: PETSC_EXTERN PetscErrorCode DSRegisterAll(const char[]);
156: PETSC_EXTERN PetscErrorCode DSRegister(const char[],const char[],const char[],PetscErrorCode(*)(DS));
157: PETSC_EXTERN PetscErrorCode DSRegisterDestroy(void);

159: /*MC
160:    DSRegisterDynamic - Adds a direct solver to the DS package.

162:    Synopsis:
163:    PetscErrorCode DSRegisterDynamic(const char *name,const char *path,const char *name_create,PetscErrorCode (*routine_create)(DS))

165:    Not collective

167:    Input Parameters:
168: +  name - name of a new user-defined DS
169: .  path - path (either absolute or relative) the library containing this solver
170: .  name_create - name of routine to create context
171: -  routine_create - routine to create context

173:    Notes:
174:    DSRegisterDynamic() may be called multiple times to add several user-defined
175:    direct solvers.

177:    If dynamic libraries are used, then the fourth input argument (routine_create)
178:    is ignored.

180:    Level: advanced

182: .seealso: DSRegisterDestroy(), DSRegisterAll()
183: M*/
184: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
185: #define DSRegisterDynamic(a,b,c,d) DSRegister(a,b,c,0)
186: #else
187: #define DSRegisterDynamic(a,b,c,d) DSRegister(a,b,c,d)
188: #endif

190: #endif